CORD-985 Tests: LXC container connectivity, Juju is ready
Change-Id: I6d690cb744c09df7d3909bf04e57551606e10f6a
diff --git a/roles/create-lxd/tasks/main.yml b/roles/create-lxd/tasks/main.yml
index bf02d9f..3e081a2 100644
--- a/roles/create-lxd/tasks/main.yml
+++ b/roles/create-lxd/tasks/main.yml
@@ -103,6 +103,11 @@
tags:
- skip_ansible_lint # connectivity check
+- name: Verify that containers have external connectivity
+ command: ansible containers -m uri -u ubuntu -a "url=http://www.google.com"
+ tags:
+ - skip_ansible_lint # connectivity check
+
- name: Have containers use the apt-cache
command: ansible containers -b -u ubuntu -m lineinfile -a "dest=/etc/apt/apt.conf.d/02apt-cacher-ng create=yes mode=0644 owner=root group=root regexp='^Acquire' line='Acquire::http { Proxy \"http://{{ apt_cacher_name }}:{{ apt_cacher_port | default('3142') }}\"; };'"
tags:
@@ -136,4 +141,3 @@
- name: Verify that we can log into every container after restarting network interfaces
when: not on_maas
command: ansible containers -m ping -u ubuntu
-
diff --git a/roles/juju-setup/tasks/main.yml b/roles/juju-setup/tasks/main.yml
index 9ce2279..69b13bf 100644
--- a/roles/juju-setup/tasks/main.yml
+++ b/roles/juju-setup/tasks/main.yml
@@ -39,9 +39,11 @@
retries: 3
delay: 10
-- name: Pause to allow juju to become ready
- pause:
- seconds: 15
+- name: Check that Juju is actually ready
+ juju_facts:
+ until: juju_machines["juju.cord.lab"] is defined and juju_machines["juju.cord.lab"]["agent_state"] == "started"
+ retries: 40
+ delay: 15
# For setwise operations on desired vs Juju state:
# list of active juju_machines names: juju_machines.keys()
@@ -51,6 +53,10 @@
when: "{{ head_lxd_list | map(attribute='service') | list | reject('undefined') | map('format_string', '%s.'~site_suffix ) | difference( juju_machines.keys() ) | length }}"
command: "juju add-machine ssh:{{ item }}"
with_items: "{{ head_lxd_list | map(attribute='service') | list | reject('undefined') | map('format_string', '%s.'~site_suffix ) | difference( juju_machines.keys() ) }}"
+ register: result
+ until: result | success
+ retries: 3
+ delay: 10
# run this again, so machines will be in the juju_machines list
- name: Obtain Juju Facts after machine creation