Browse Source

Add separate service and config changes handlers

master
Alex 1 year ago
parent
commit
b6f5c6a4f1
Signed by: caskd GPG Key ID: F92BA85F61F4C173
  1. 9
      handlers/main.yml
  2. 3
      tasks/main.yml

9
handlers/main.yml

@ -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

3
tasks/main.yml

@ -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