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?

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/56B69D59.40605%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to