Add separate service and config changes handlers

This commit is contained in:
Alex 2020-06-05 15:41:47 +02:00
parent 64e64e6b03
commit b6f5c6a4f1
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,3 @@
- name: Reload daemon
systemd:
daemon_reload: true
- name: Run service actions
loop: "{{ systemd.services }}"
systemd:
@ -8,3 +5,9 @@
enabled: "{% if item.enabled|default(false) %}yes{% else %}no{% endif %}"
state: "{{ item.action }}"
daemon_reload: "{% if item.daemon_reload|default(false) %}yes{% else %}no{% endif %}"
- name: Restart services
loop: "{{ systemd.services }}"
systemd:
name: '{{ item.name }}'
state: "restarted"
daemon_reload: true

View File

@ -15,8 +15,7 @@
src: "{{ item }}.service.j2"
dest: "/etc/systemd/system/{{ item }}.service.d/override.conf"
notify:
- Reload daemon
- Run service actions
- Restart services
when: (systemd.overrides| default([])) | length
tags:
- systemd