From 7fa98de77b56e2b7eb72793e4ddd3df1153d6f77 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 12 Jul 2017 17:54:30 +0100 Subject: [PATCH] Ensure that keystone restarts after db sync When the db expand/migrate options are required, the keystone service is stopped but never notified to start again. This patch ensures that it is properly stopped, and properly notified. Change-Id: Ide64927e43e7684f03be7a73b893283c80e89afc --- tasks/keystone_db_setup.yml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tasks/keystone_db_setup.yml b/tasks/keystone_db_setup.yml index fe5ae49b..73d7f9e9 100644 --- a/tasks/keystone_db_setup.yml +++ b/tasks/keystone_db_setup.yml @@ -43,22 +43,28 @@ tags: - keystone-config +# When keystone is initially built, the service does not yet exist on the +# host this task is executed on. We therefore use failed_when for the task +# to catch a failure that's outside the norm. - name: Ensure keystone service is stopped service: name: "{{ item }}" state: stopped - register: keystone_stop - failed_when: - - "keystone_stop.msg is defined" - - "'no service or tool' not in keystone_stop.msg" - - "'systemd could not find' not in keystone_stop.msg" - - "'Could not find the requested service' not in keystone_stop.msg" - with_items: - - "{{ keystone_wsgi_program_names }}" - - "{{ keystone_system_service_name }}" + register: _stop + until: _stop | success + retries: 5 + delay: 2 + with_items: "{{ keystone_wsgi_program_names }}" when: - "(ansible_local['openstack_ansible']['keystone']['need_db_expand'] | bool) or (ansible_local['openstack_ansible']['keystone']['need_db_migrate'] | bool)" + failed_when: + - "_stop.msg is defined" + - "'no service or tool' not in _stop.msg" + - "'systemd could not find' not in _stop.msg" + - "'Could not find the requested service' not in _stop.msg" + notify: + - Restart uWSGI - name: Perform a Keystone DB sync expand command: "{{ keystone_bin }}/keystone-manage db_sync --expand"