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