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: I831f6d62f0d31384258571e01a4e7cdd75b73e2c
This commit is contained in:
Dmitriy Rabotyagov 2023-04-10 16:57:55 +02:00
parent a44d332075
commit 090b0aeb07
2 changed files with 9 additions and 1 deletions

View File

@ -27,6 +27,7 @@
listen:
- "Restart neutron services"
- "venv changed"
- "systemd service changed"
# NOTE(cloudnull):
# When installing or upgrading it is possible that an old metadata proxy process will not
@ -130,6 +131,7 @@
listen:
- "Restart neutron services"
- "venv changed"
- "systemd service changed"
- name: start ovn service
service:

View File

@ -340,7 +340,13 @@ filtered_neutron_services: |-
(('service_en' not in value) or
('service_en' in value and value['service_en'])) 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 %}