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: I4273d2fbcbff3028e693e3274093c1afebdcfca2
This commit is contained in:
Dmitriy Rabotyagov 2023-04-11 11:54:07 +02:00
parent b6e904213e
commit 94690a06da
2 changed files with 10 additions and 1 deletions

View File

@ -70,6 +70,7 @@
- "Restart nova services"
- "venv changed"
- "cert installed"
- "systemd service changed"
- name: Start services
service:
@ -86,3 +87,4 @@
- "Restart nova services"
- "venv changed"
- "cert installed"
- "systemd service changed"

View File

@ -41,7 +41,14 @@ filtered_nova_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 %}