I have an Ansible role which uses handlers to restart services via the systemd module.
- name: restart ntp
systemd:
name: ntp
enabled: yes
state: restarted
become: true
- name: restart web server
systemd:
name: nginx
enabled: yes
state: restarted
become: true
- name: restart grafana
systemd:
name: grafana
enabled: yes
state: restarted
become: true
Is there a way so I could parameterize the three separate handlers into something like this?:
- name: restart {{svcname}}
systemd:
name: '{{svcname}}'
enabled: yes
state: restarted
become: true
set_facttask. The point of handlers is to make this whole process seamless and low-maintenance. I'd lose all that by using something like your proposed method, even though it may be technically viable. – 0xC0000022L Nov 27 '18 at 13:24