Ensure service is restarted on unit file changes

At the moment we don't restart services if systemd unit file is changed.

We knowingly prevent systemd_service role handlers to execute
by providing `state: started` as otherwise service will be restarted twice.
With that now  we ensure that role handlers will also listen for systemd
unit changes.

Change-Id: I0265fc94d795360f6dfbddee5398ee067ea0422b
This commit is contained in:
Dmitriy Rabotyagov 2023-04-10 16:00:41 +02:00
parent f8d185d58a
commit 8e875ef8ee
2 changed files with 4 additions and 2 deletions

View File

@ -30,6 +30,7 @@
listen:
- "Restart gnocchi services"
- "venv changed"
- "systemd service changed"
# Note (odyssey4me):
# The policy.json file is currently read continually by the services
@ -68,3 +69,4 @@
listen:
- "Restart gnocchi services"
- "venv changed"
- "systemd service changed"

View File

@ -51,8 +51,8 @@ filtered_gnocchi_services: |-
{% set _ = service.update(
{
'service_key': name,
'enabled': 'yes',
'state': 'started',
'enabled': service['enabled'] | default(True),
'state': service['state'] | default('started'),
'config_overrides': service.init_config_overrides
}
)