blob: 2dafc6057170e77a133686b5cb231ab58184037b [file] [log] [blame]
Peter Pentchevf48f48b2022-12-07 16:51:16 +02001- hosts: all
2 tasks:
Peter Pentchevf48f48b2022-12-07 16:51:16 +02003 - name: Install juju
Peter Pentchevd26369b2022-12-08 11:39:21 +02004 ansible.builtin.command: snap install juju --classic
5 become: true
Peter Pentchevf48f48b2022-12-07 16:51:16 +02006
7 - name: Log In to the Controller
Biser Milanovea8c5c52022-12-13 09:56:47 +02008 no_log: true
Peter Pentchevdec9e8f2022-12-08 14:33:20 +02009 block:
Biser Milanovc316ea32023-11-21 18:25:49 +020010 # 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 Milanov9947da92022-12-13 14:52:05 +020016
Peter Pentchevdec9e8f2022-12-08 14:33:20 +020017 - name: Log in
Biser Milanov67e48882023-11-21 17:52:26 +020018 ansible.builtin.shell: juju login 10.4.2.241:17070 --controller maas-controller --user zuul-nodepool-zaza
Peter Pentchevdec9e8f2022-12-08 14:33:20 +020019 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 Milanov9947da92022-12-13 14:52:05 +020027 - 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 Pentchevdec9e8f2022-12-08 14:33:20 +020031
Biser Milanov9947da92022-12-13 14:52:05 +020032 - 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 Milanov81e9eb92023-11-21 17:58:56 +020036 always:
37 - name: Debug sleep
38 ansible.builtin.shell: sleep 9999