Add a job that sets up a Juju client

Change-Id: I5c1d92bdcf68e930af11b7ff5189dd553591569c
diff --git a/playbooks/setup-juju-client/post.yaml b/playbooks/setup-juju-client/post.yaml
new file mode 100644
index 0000000..b57e2fe
--- /dev/null
+++ b/playbooks/setup-juju-client/post.yaml
@@ -0,0 +1,7 @@
+- hosts: all
+  tasks:
+  - name: Log Out of the Controller
+    ansible.builtin.command: juju logout
+
+  - name: Remove the Juju Configuration Directory
+    ansible.builtin.command: rm -rf ~/.local/share/juju
diff --git a/playbooks/setup-juju-client/pre.yaml b/playbooks/setup-juju-client/pre.yaml
new file mode 100644
index 0000000..c3e4c7d
--- /dev/null
+++ b/playbooks/setup-juju-client/pre.yaml
@@ -0,0 +1,11 @@
+- hosts: all
+  tasks:
+  # TODO: snap module is part of the community collection
+  - name: Install juju
+      ansible.builtin.command: snap install juju --classic
+      become: true
+
+  - name: Log In to the Controller
+      ansible.builtin.shell: echo -e "y\n{{ juju_secret['the_secret'] }}\n" | juju login 10.40.2.2:17070 --controller maas-controller --user zuul-nodepool-zaza
+      args:
+      executable: /usr/bin/bash
diff --git a/zuul.d/setup-juju-client.yaml b/zuul.d/setup-juju-client.yaml
new file mode 100644
index 0000000..54e8682
--- /dev/null
+++ b/zuul.d/setup-juju-client.yaml
@@ -0,0 +1,27 @@
+---
+- secret:
+    name: juju-secret
+    data:
+      the_secret: !encrypted/pkcs1-oaep
+        - ilS+sn8F5b/Q1NWRMcvIj1xz+wepBdJDBEuyHGAiwE2zSY/E/aUjh/LekHcnUYB4BKdVf
+          lyxh+kcwwsBPSbBfP71eooo12K+8fmn+r2q7eYCDD67CTa64cqEatNIEOrXJPaRrB1iZz
+          NiioMaUjzLucevcqpeaCVBmg2XrZPeHAYr8chmC1Pf8gvNyPUiBQ40R3dIGE7kDFxJE9T
+          n2d7f2cosGlL4DSQT6dTRNaRDHTA/Uv2NJwUHDGaE2xTho1Iu+5qfJwdcv6PlaroS+B/z
+          XSAfIaqKaVRmuHi722/wwbW+86NWBgZloj23hkPb59bsaOv2GODPNdCeGjfl10//GCHbU
+          k6F8E1OBYpyvVuf8XNPURtDPxWFJSZ5bO7GM+mD7MdgEav+y2s8GYBYt8fcCB+zFovqWW
+          FoDMeLJY5uYX9Be5d7DKiLs9oE3KSKLZ9E8mHNXy2ypPnUuQ6cDZAS+XObttCKY67azog
+          oNOZGLVJhP4k0/3zTHTmnyK+EnFzHOx5zElLfhNEZG674CKBfSXYQIUvT7YK2AIuEYIps
+          Nh8uypr7e+lTP7uElfcTeHuok6OHAq1hNDGHGdlNmf5DxmRbBplnQzz//cMsCQfbCf5Qy
+          cMIu6PhNyUnZh/PVocIYCLw0FeJlyRZ0KD/NW8S6Xv2Ayb4OHPSMxaTXWiRd/8=
+
+- job:
+    name: setup-juju-client
+    parent: base
+    description: Prepare hosts for Juju connections
+    pre-run: playbooks/setup-juju-client/pre.yaml
+    post-run: playbooks/setup-juju-client/post.yaml
+    timeout: 1800
+    attempts: 3
+    secrets:
+    - name: juju_secret
+      secret: juju-secret