diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 803e769ffd..431de1dc6f 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -28,6 +28,7 @@ kolla_external_address: "{{ kolla_internal_address }}" kolla_enable_sanity_checks: no kolla_enable_sanity_keystone: "{{ kolla_enable_sanity_checks }}" +kolla_enable_sanity_glance: "{{ kolla_enable_sanity_checks }}" #################### # Database options diff --git a/ansible/roles/glance/tasks/check.yml b/ansible/roles/glance/tasks/check.yml new file mode 100644 index 0000000000..73303b2ec4 --- /dev/null +++ b/ansible/roles/glance/tasks/check.yml @@ -0,0 +1,20 @@ +--- + +- name: Glance sanity checks + command: docker exec -t kolla_ansible /usr/bin/ansible localhost + -m kolla_sanity + -a "service=glance + project=service + user=admin + password={{ glance_keystone_password }} + role=admin + region_name={{ openstack_region_name }} + auth={{ '{{ openstack_glance_auth }}' }}" + -e "{'openstack_glance_auth':{{ openstack_glance_auth }}}" + register: glance_sanity + changed_when: "{{ glance_sanity.stdout.find('localhost | SUCCESS => ') != -1 and (glance_sanity.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + until: glance_sanity.stdout.split()[2] == 'SUCCESS' + retries: 10 + delay: 5 + run_once: True + when: kolla_enable_sanity_glance | bool diff --git a/ansible/roles/glance/tasks/main.yml b/ansible/roles/glance/tasks/main.yml index f3b739a0f9..450db4f932 100644 --- a/ansible/roles/glance/tasks/main.yml +++ b/ansible/roles/glance/tasks/main.yml @@ -19,3 +19,7 @@ - include: start.yml when: inventory_hostname in groups['glance-api'] or inventory_hostname in groups['glance-registry'] + +- include: check.yml + when: inventory_hostname in groups['glance-api'] or + inventory_hostname in groups['glance-registry'] diff --git a/ansible/roles/keystone/tasks/check.yml b/ansible/roles/keystone/tasks/check.yml index 17fb17d14c..328a5e3876 100644 --- a/ansible/roles/keystone/tasks/check.yml +++ b/ansible/roles/keystone/tasks/check.yml @@ -14,7 +14,7 @@ register: keystone_sanity changed_when: "{{ keystone_sanity.stdout.find('localhost | SUCCESS => ') != -1 and (keystone_sanity.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" until: keystone_sanity.stdout.split()[2] == 'SUCCESS' - retries: 1 + retries: 10 delay: 5 run_once: True when: kolla_enable_sanity_keystone | bool \ No newline at end of file diff --git a/docker/kolla-ansible/kolla_sanity.py b/docker/kolla-ansible/kolla_sanity.py index 3227bfb949..d579a1093a 100644 --- a/docker/kolla-ansible/kolla_sanity.py +++ b/docker/kolla-ansible/kolla_sanity.py @@ -28,7 +28,11 @@ import shade class SanityChecks(object): @staticmethod def keystone(cloud): - cloud.keystone_client.tenants.list() + [tenant for tenant in cloud.keystone_client.tenants.list()] + + @staticmethod + def glance(cloud): + [image for image in cloud.glance_client.images.list()] def main():