Only try to stop services that exist
Test for the presence of services before trying to stop them.
Avoids a delay during initial deploy.
Change-Id: Id3ccba83a402074af77b62f67754a834d6f765b7
(cherry picked from commit 966b08123c
)
This commit is contained in:
parent
56e5de6458
commit
705f58fb0b
@ -44,25 +44,27 @@
|
|||||||
- keystone-config
|
- keystone-config
|
||||||
|
|
||||||
# When keystone is initially built, the service does not yet exist on the
|
# 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
|
# host this task is executed on. Detect the presence of the services.
|
||||||
# to catch a failure that's outside the norm.
|
- name: Test if keystone service exists
|
||||||
- name: Ensure keystone service is stopped
|
|
||||||
service:
|
service:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
|
check_mode: yes
|
||||||
|
register: keystone_service_exists
|
||||||
|
with_items: "{{ keystone_wsgi_program_names }}"
|
||||||
|
|
||||||
|
- name: Ensure keystone service is stopped
|
||||||
|
service:
|
||||||
|
name: "{{ item.name }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
register: _stop
|
register: _stop
|
||||||
until: _stop | success
|
until: _stop | success
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
with_items: "{{ keystone_wsgi_program_names }}"
|
with_items: "{{ keystone_service_exists.results }}"
|
||||||
when:
|
when:
|
||||||
- "(ansible_local['openstack_ansible']['keystone']['need_db_expand'] | bool) or
|
- "(ansible_local['openstack_ansible']['keystone']['need_db_expand'] | bool) or
|
||||||
(ansible_local['openstack_ansible']['keystone']['need_db_migrate'] | bool)"
|
(ansible_local['openstack_ansible']['keystone']['need_db_migrate'] | bool)"
|
||||||
failed_when:
|
- "(item.status['LoadState'] == 'loaded' | bool)"
|
||||||
- "_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:
|
notify:
|
||||||
- Manage LB
|
- Manage LB
|
||||||
- Restart uWSGI
|
- Restart uWSGI
|
||||||
|
Loading…
Reference in New Issue
Block a user