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 |
Biser Milanov | ea8c5c5 | 2022-12-13 09:56:47 +0200 | [diff] [blame] | 9 | no_log: true |
Peter Pentchev | dec9e8f | 2022-12-08 14:33:20 +0200 | [diff] [blame] | 10 | block: |
Biser Milanov | 9947da9 | 2022-12-13 14:52:05 +0200 | [diff] [blame] | 11 | |
Peter Pentchev | dec9e8f | 2022-12-08 14:33:20 +0200 | [diff] [blame] | 12 | - name: Log in |
| 13 | ansible.builtin.shell: juju login 10.40.2.2:17070 --controller maas-controller --user zuul-nodepool-zaza |
| 14 | args: |
| 15 | stdin: "y\n{{ juju_secret['the_secret'] }}\n" |
| 16 | |
| 17 | - name: Enter our password a second time |
| 18 | ansible.builtin.shell: juju clouds |
| 19 | args: |
| 20 | stdin: "{{ juju_secret['the_secret'] }}\n" |
| 21 | |
Biser Milanov | 9947da9 | 2022-12-13 14:52:05 +0200 | [diff] [blame] | 22 | - name: Prepare Juju credentials file |
| 23 | ansible.builtin.shell: umask 177 && echo "credentials:" > ~/.local/share/juju/credentials.yaml |
| 24 | args: |
| 25 | executable: /usr/bin/bash |
Peter Pentchev | dec9e8f | 2022-12-08 14:33:20 +0200 | [diff] [blame] | 26 | |
Biser Milanov | 9947da9 | 2022-12-13 14:52:05 +0200 | [diff] [blame] | 27 | - name: Grab the Juju credentials and store them in a file |
| 28 | ansible.builtin.shell: juju credentials --controller maas-controller --format yaml --show-secrets | tail -n +2 >> ~/.local/share/juju/credentials.yaml |
| 29 | args: |
| 30 | executable: /usr/bin/bash |
| 31 | |