Peter Pentchev | f48f48b | 2022-12-07 16:51:16 +0200 | [diff] [blame] | 1 | - hosts: all |
| 2 | tasks: |
Peter Pentchev | f48f48b | 2022-12-07 16:51:16 +0200 | [diff] [blame] | 3 | - name: Install juju |
Peter Pentchev | d26369b | 2022-12-08 11:39:21 +0200 | [diff] [blame] | 4 | ansible.builtin.command: snap install juju --classic |
| 5 | become: true |
Peter Pentchev | f48f48b | 2022-12-07 16:51:16 +0200 | [diff] [blame] | 6 | |
| 7 | - name: Log In to the Controller |
Biser Milanov | ea8c5c5 | 2022-12-13 09:56:47 +0200 | [diff] [blame] | 8 | no_log: true |
Peter Pentchev | dec9e8f | 2022-12-08 14:33:20 +0200 | [diff] [blame] | 9 | block: |
Biser Milanov | c316ea3 | 2023-11-21 18:25:49 +0200 | [diff] [blame^] | 10 | # Needed because: https://bugs.launchpad.net/juju/+bug/1995697 |
| 11 | - name: Ensure '~/.local/share' exists |
| 12 | ansible.builtin.file: |
| 13 | path: "{{ ansible_env.HOME }}/.local/share" |
| 14 | state: directory |
| 15 | mode: '0775' |
Biser Milanov | 9947da9 | 2022-12-13 14:52:05 +0200 | [diff] [blame] | 16 | |
Peter Pentchev | dec9e8f | 2022-12-08 14:33:20 +0200 | [diff] [blame] | 17 | - name: Log in |
Biser Milanov | 67e4888 | 2023-11-21 17:52:26 +0200 | [diff] [blame] | 18 | ansible.builtin.shell: juju login 10.4.2.241:17070 --controller maas-controller --user zuul-nodepool-zaza |
Peter Pentchev | dec9e8f | 2022-12-08 14:33:20 +0200 | [diff] [blame] | 19 | args: |
| 20 | stdin: "y\n{{ juju_secret['the_secret'] }}\n" |
| 21 | |
| 22 | - name: Enter our password a second time |
| 23 | ansible.builtin.shell: juju clouds |
| 24 | args: |
| 25 | stdin: "{{ juju_secret['the_secret'] }}\n" |
| 26 | |
Biser Milanov | 9947da9 | 2022-12-13 14:52:05 +0200 | [diff] [blame] | 27 | - name: Prepare Juju credentials file |
| 28 | ansible.builtin.shell: umask 177 && echo "credentials:" > ~/.local/share/juju/credentials.yaml |
| 29 | args: |
| 30 | executable: /usr/bin/bash |
Peter Pentchev | dec9e8f | 2022-12-08 14:33:20 +0200 | [diff] [blame] | 31 | |
Biser Milanov | 9947da9 | 2022-12-13 14:52:05 +0200 | [diff] [blame] | 32 | - name: Grab the Juju credentials and store them in a file |
| 33 | ansible.builtin.shell: juju credentials --controller maas-controller --format yaml --show-secrets | tail -n +2 >> ~/.local/share/juju/credentials.yaml |
| 34 | args: |
| 35 | executable: /usr/bin/bash |
Biser Milanov | 81e9eb9 | 2023-11-21 17:58:56 +0200 | [diff] [blame] | 36 | always: |
| 37 | - name: Debug sleep |
| 38 | ansible.builtin.shell: sleep 9999 |