CORD-807
prep for removal of gradle from platform-install
refresh apt cache
improve SSH port check
add inventory for running on head node
copy of /opt/cord happens in cord repo now
fix how SSH pubkey is handled for LXD
fix perms during pki CA dir creation
PKI/credentials permissions
retry juju add-machine
checks/pauses to allow juju or containers to be ready

Change-Id: Iababb1bd8e464ae1d44c9b252d9bc07d66cf0872
diff --git a/roles/juju-setup/tasks/main.yml b/roles/juju-setup/tasks/main.yml
index 554add9..9ce2279 100644
--- a/roles/juju-setup/tasks/main.yml
+++ b/roles/juju-setup/tasks/main.yml
@@ -31,6 +31,18 @@
     src={{ juju_config_name }}_juju_config.yml.j2
     dest={{ juju_config_path }}
 
+# check that containers are ready to be accessed, juju add-machine may error
+- name: Check that machines are available for Juju
+  command: ansible containers -m ping -u ubuntu
+  tags:
+    - skip_ansible_lint # connectivity check
+  retries: 3
+  delay: 10
+
+- name: Pause to allow juju to become ready
+  pause:
+    seconds: 15
+
 # For setwise operations on desired vs Juju state:
 # list of active juju_machines names: juju_machines.keys()
 # list of active juju_services names: juju_services.keys()