Hi guys.
I'm wondering on how to tackle `systemd` with ansible. Problem is that
if I deploy or change systemd unit file with ansible, just managing
service won't do it because `systemctl daemon-reload` have to run for
systemd to read new service configuration.
There are two approaches I can think of.
1. Have a handler like this:
roles/elasticsearch/handlers/main.yml:
---
name: reload-systemd
sudo: yes
shell: systemctl daemon-reload
in every role that modifies unit files.
2. Have a dedicated systemd role, with handler like the one described up
there, in a file:
roles/systemd/handlers/main.yml:
and then use meta dependencies in all roles that modify systemd unit
files, something like this:
roles/elasticsearch/meta/main.yml:
---
dependencies:
- { role: systemd }
So, what do you guys suggest?
I've read up on:
https://github.com/ansible/ansible-modules-core/issues/191
but my question goes a little bit beyond just this specific systemd
issue. I'm wondering about drawbacks of meta dependencies vs
copy/pasting exactly the same snippet in multiple roles?
Are there some guidelines for this specific scenario?