openstack-ansible-os_trove/handlers/main.yml
Dmitriy Rabotyagov 21619ca389 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
2021-04-26 12:39:46 +03:00

46 lines
1.3 KiB
YAML

---
# Copyright 2016 Internet Solutions (Pty) Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# (c) 2016 Donovan Francesco <donovan.francesco@is.co.za>
# (c) 2016 Paul Stevens <paul.stevens@is.co.za>
- name: Restart Trove services
systemd:
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"
# NOTE (noonedeadpunk): Remove this task after Xena release
- name: Remove obsoleted config files
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/trove/policy.json
- /etc/trove/trove-conductor.conf
- /etc/trove/trove-taskmanager.conf
listen:
- "Restart trove services"
- "venv changed"