From f632cfe8783aed50177d3f2b9924a6074f42810d Mon Sep 17 00:00:00 2001 From: Michal Jastrzebski Date: Fri, 20 Nov 2015 10:35:25 -0600 Subject: [PATCH] Sanity check for keystone This runs first sanity check for keystone. After keystone is deployed it checks tenants.list() Change-Id: Ie919ffe6124eb70428309404a434d9b0eb0b9f70 Partially-Implements: blueprint sanity-check-container --- ansible/group_vars/all.yml | 3 +++ ansible/roles/keystone/defaults/main.yml | 2 ++ ansible/roles/keystone/tasks/check.yml | 20 ++++++++++++++++++++ ansible/roles/keystone/tasks/main.yml | 2 ++ 4 files changed, 27 insertions(+) create mode 100644 ansible/roles/keystone/tasks/check.yml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index d2563734b7..803e769ffd 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -25,6 +25,9 @@ kolla_install_type: "binary" # Value set in the public_url endpoint in Keystone kolla_external_address: "{{ kolla_internal_address }}" +kolla_enable_sanity_checks: no + +kolla_enable_sanity_keystone: "{{ kolla_enable_sanity_checks }}" #################### # Database options diff --git a/ansible/roles/keystone/defaults/main.yml b/ansible/roles/keystone/defaults/main.yml index 5f33e2f28e..d9a53ca37d 100644 --- a/ansible/roles/keystone/defaults/main.yml +++ b/ansible/roles/keystone/defaults/main.yml @@ -26,3 +26,5 @@ keystone_internal_address: "{{ kolla_internal_address }}" keystone_logging_verbose: "{{ openstack_logging_verbose }}" keystone_logging_debug: "{{ openstack_logging_debug }}" + +openstack_keystone_auth: "{'auth_url':'{{ openstack_auth_v2.auth_url }}','username':'{{ openstack_auth_v2.username }}','password':'{{ openstack_auth_v2.password }}','project_name':'{{ openstack_auth_v2.project_name }}'}" diff --git a/ansible/roles/keystone/tasks/check.yml b/ansible/roles/keystone/tasks/check.yml new file mode 100644 index 0000000000..17fb17d14c --- /dev/null +++ b/ansible/roles/keystone/tasks/check.yml @@ -0,0 +1,20 @@ +--- + +- name: Keystone sanity checks + command: docker exec -t kolla_ansible /usr/bin/ansible localhost + -m kolla_sanity + -a "service=keystone + project=service + user=admin + password={{ keystone_admin_password }} + role=admin + region_name={{ openstack_region_name }} + auth={{ '{{ openstack_keystone_auth }}' }}" + -e "{'openstack_keystone_auth':{{ openstack_keystone_auth }}}" + 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 + delay: 5 + run_once: True + when: kolla_enable_sanity_keystone | bool \ No newline at end of file diff --git a/ansible/roles/keystone/tasks/main.yml b/ansible/roles/keystone/tasks/main.yml index f00b4f0e6a..de4178148f 100644 --- a/ansible/roles/keystone/tasks/main.yml +++ b/ansible/roles/keystone/tasks/main.yml @@ -7,3 +7,5 @@ - include: start.yml when: inventory_hostname in groups['keystone'] + +- include: check.yml