Adjust service restart handlers

We should make service restart handlers more universal, since
there might be cases where api and taskmanager are placed on different
hosts. So we should restart services only when they are present, and
filtered_trove_services helps us here as defines only services that
should exist on the host.

This also align handler with other services and fix taskmanager restart
as it is missing now but conductor is restarted twice instead.

Change-Id: Ia5c92f312a773c88563c61bba327f07ef369d62c
This commit is contained in:
Dmitriy Rabotyagov 2021-04-26 12:39:46 +03:00
parent 2a4ec0de84
commit 21619ca389
1 changed files with 9 additions and 18 deletions

View File

@ -15,27 +15,18 @@
#
# (c) 2016 Donovan Francesco <donovan.francesco@is.co.za>
# (c) 2016 Paul Stevens <paul.stevens@is.co.za>
- name: Restart trove API services
systemd:
name: "{{ trove_services['trove-api']['service_name'] }}"
state: "restarted"
when: "'trove-api' in filtered_trove_services"
listen:
- "Restart trove services"
- "venv changed"
- name: Restart trove conductor service
- name: Restart Trove services
systemd:
name: "{{ trove_services['trove-conductor']['service_name'] }}"
state: "restarted"
listen:
- "Restart trove services"
- "venv changed"
- name: Restart trove taskmanager service
systemd:
name: "{{ trove_services['trove-conductor']['service_name'] }}"
name: "{{ item.service_name }}"
enabled: yes
state: "restarted"
daemon_reload: yes
with_items: "{{ filtered_trove_services }}"
register: _restart
until: _restart is success
retries: 5
delay: 2
listen:
- "Restart trove services"
- "venv changed"