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: I8ce4f18e853ee0c55970012f4c40574960607441
This commit is contained in:
Dmitriy Rabotyagov 2023-04-07 10:29:07 +02:00 committed by Damian Dąbrowski
parent 7444c804a9
commit f761ea36b7
2 changed files with 4 additions and 2 deletions

View File

@ -26,6 +26,7 @@
delay: 2
listen:
- Restart adjutant services
- systemd service changed
- name: Start services
service:
@ -42,3 +43,4 @@
delay: 2
listen:
- Restart adjutant services
- systemd service changed

View File

@ -119,8 +119,8 @@
systemd_TasksAccounting: true
systemd_services:
- service_name: "{{ service_var.service_name }}"
enabled: yes
state: started
enabled: "{{ service_var.enabled | default(True) }}"
state: "{{ service_var.state | default('started') }}"
execstarts: "{{ service_var.execstarts }}"
execreloads: "{{ service_var.execreloads | default([]) }}"
config_overrides: "{{ service_var.init_config_overrides }}"