blob: 2932385b1a149c6212ee06ddc4543c0de63b98db [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
Peter Pentchevdec9e8f2022-12-08 14:33:20 +02009 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"