blob: fe5975878bdf006a034f0c99d69a4916a4e07d11 [file] [log] [blame]
Peter Pentchevf48f48b2022-12-07 16:51:16 +02001- hosts: all
2 tasks:
3 # TODO: snap module is part of the community collection
4 - name: Install juju
Peter Pentchevd26369b2022-12-08 11:39:21 +02005 ansible.builtin.command: snap install juju --classic
6 become: true
Peter Pentchevf48f48b2022-12-07 16:51:16 +02007
8 - name: Log In to the Controller
Biser Milanovea8c5c52022-12-13 09:56:47 +02009 no_log: true
Peter Pentchevdec9e8f2022-12-08 14:33:20 +020010 block:
11 - name: Log in
12 ansible.builtin.shell: juju login 10.40.2.2:17070 --controller maas-controller --user zuul-nodepool-zaza
13 args:
14 stdin: "y\n{{ juju_secret['the_secret'] }}\n"
15
16 - name: Enter our password a second time
17 ansible.builtin.shell: juju clouds
18 args:
19 stdin: "{{ juju_secret['the_secret'] }}\n"
20
21 - name: Grab the Ansible credentials
22 ansible.builtin.shell: juju credentials --controller maas-controller --format yaml --show-secrets
23 register: juju_credentials_full
24
25 - name: Store them into a file
26 ansible.builtin.copy:
27 dest: /home/ubuntu/.local/share/juju/credentials.yaml
28 content: "credentials:\n{{ juju_credentials_full.stdout_lines[1:] | join('\n') }}\n"