Hi folks, I've got a handler that I want to make available globally; that is, I want any host to be able to notify it, from within any role.
Specifically, many of my various roles are installing custom NRPE commands for monitoring, and therefore they will want to notify the nagios NRPE service to restart. Obviously I don't want to define the same "restart nrpe" handler in every role, that would be silly. But the other options don't seem very attractive either. I can put "restart nrpe" in a top-level handlers/handlers.yml file, but because handlers are apparently only registered within the scope of a "play", I still have to put "handlers: [ include: handlers/handlers.yml ]" in every single play, and since there is pretty much one play for every role, that's a lot of repetition. I could also put the "restart nrpe" handler inside a role, and make that role a dependency of every other role, but that a) is still a lot of repetition, and b) causes the dependency role to get executed multiple times unnecessarily. Is there a nice DRY way to do this that I'm missing? What I'd really like is if Ansible would always include handlers from the top-level "handlers" directory, for every play, automatically. Kind of like the way you can put templates in a top-level "templates" directory, and they are always available regardless of what role or play you are in. Thanks for your time, BJ -- 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/c6c99731-a31f-4127-af9f-88fe1f4f5d35%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
