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. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/879671 Change-Id: I8140add1a4e4fdacee89bd29bd2e3c87eff0953a
This commit is contained in:
parent
369f01589c
commit
92aba932b1
@ -27,6 +27,7 @@
|
||||
listen:
|
||||
- "Restart cinder services"
|
||||
- "venv changed"
|
||||
- "systemd service changed"
|
||||
|
||||
- name: Start services
|
||||
service:
|
||||
@ -42,6 +43,7 @@
|
||||
listen:
|
||||
- "Restart cinder services"
|
||||
- "venv changed"
|
||||
- "systemd service changed"
|
||||
|
||||
- name: Ensure tgt service restarted
|
||||
service:
|
||||
|
@ -55,22 +55,7 @@
|
||||
systemd_BlockIOAccounting: true
|
||||
systemd_MemoryAccounting: true
|
||||
systemd_TasksAccounting: true
|
||||
systemd_services: |-
|
||||
{% set services = [] %}
|
||||
{% for service in filtered_cinder_services %}
|
||||
{%
|
||||
set _ = service.update(
|
||||
{
|
||||
'enabled': 'yes',
|
||||
'state': 'started',
|
||||
'config_overrides': cinder_environment_overrides | combine(service.init_config_overrides, recursive=True)
|
||||
}
|
||||
)
|
||||
%}
|
||||
{% set _ = service.pop('init_config_overrides') -%}
|
||||
{% set _ = services.append(service) -%}
|
||||
{% endfor %}
|
||||
{{ services }}
|
||||
systemd_services: "{{ filtered_cinder_services }}"
|
||||
tags:
|
||||
- cinder-config
|
||||
- systemd-service
|
||||
|
@ -34,7 +34,15 @@ filtered_cinder_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'),
|
||||
'config_overrides': cinder_environment_overrides | combine(value.init_config_overrides, recursive=True)
|
||||
}
|
||||
) %}
|
||||
{% set _ = value.pop('init_config_overrides') -%}
|
||||
{% set _ = services.append(value) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user