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: I4eec982a682bfff121f9658c6d4eb3d1db8cb94f
This commit is contained in:
Dmitriy Rabotyagov 2023-04-10 16:33:54 +02:00
parent b8865bde4c
commit ab4b4a1d25
2 changed files with 9 additions and 1 deletions

View File

@ -27,6 +27,7 @@
listen:
- "Restart manila services"
- "venv changed"
- "systemd service changed"
- name: Start services
service:
@ -42,3 +43,4 @@
listen:
- "Restart manila services"
- "venv changed"
- "systemd service changed"

View File

@ -31,7 +31,13 @@ filtered_manila_services: |-
(('condition' not in value) or
('condition' in value and value['condition'])) and
not ('wsgi_app' in value and value['wsgi_app']) %}
{% set _ = value.update({'service_key': key}) %}
{% set _ = value.update(
{
'service_key': key,
'enabled': value['enabled'] | default(True),
'state': value['state'] | default('started'),
}
) %}
{% set _ = services.append(value) %}
{% endif %}
{% endfor %}