# Triggering handlers from another role

**URL:** <https://forum.ansible.com/t/triggering-handlers-from-another-role/14735>\
**Category:** Ansible Project\
**Created:** [March 9, 2014, 3:08pm UTC](https://forum.ansible.com/t/triggering-handlers-from-another-role/14735 "2014-03-09T15:08:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hagai\_Kariti](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Hagai\_Kariti](https://forum.ansible.com/u/Hagai_Kariti)\
**Post date:** [March 9, 2014, 3:08pm UTC](https://forum.ansible.com/t/triggering-handlers-from-another-role/14735/1 "2014-03-09T15:08:04Z")

</div>

Hi all,  
I’m updating a service’s configurations and I need to trigger a reload. Tricky thing is both services have different roles, specifically a RabbitMQ role that add a config file for Collectd. Ideally I could just notify collect’d handler, but as they are in different roles (and I would like to keep them independent) I can’t be sure collectd’s handler will be defined when rabbitmq’s tasks are run. My instinct is that there should be a feature for making handlers from all roles globally available, or lazy-loading handlers on demand from the role path. Is there a simpler solution that currently works, though?

Thanks!

---

<div class="post-metadata">

**Author:** ![Nick\_Groenen](https://avatars.discourse-cdn.com/v4/letter/n/c77e96/32.png) [@Nick\_Groenen](https://forum.ansible.com/u/Nick_Groenen)\
**Post date:** [March 10, 2014, 4:28pm UTC](https://forum.ansible.com/t/triggering-handlers-from-another-role/14735/2 "2014-03-10T16:28:54Z")

</div>

You can include handlers from another file, the same way you can  
include tasks. In your-role/handers/main.yml, you might for example  
have:

- include: ../../some-other-role/handlers/main.yml

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [March 10, 2014, 5:50pm UTC](https://forum.ansible.com/t/triggering-handlers-from-another-role/14735/3 "2014-03-10T17:50:07Z")

</div>

“My instinct is that there should be a feature for making handlers from all roles globally available”

Yep, this isn’t needed as handlers are already globally accessible by name. You can, for instance, define “restart apache” in roles/common/handlers/main.yml and reference it from other roles later on.

---

<div class="post-metadata">

**Author:** ![Hagai\_Kariti](https://avatars.discourse-cdn.com/v4/letter/h/4491bb/32.png) [@Hagai\_Kariti](https://forum.ansible.com/u/Hagai_Kariti)\
**Post date:** [March 11, 2014, 1:06pm UTC](https://forum.ansible.com/t/triggering-handlers-from-another-role/14735/4 "2014-03-11T13:06:44Z")

</div>

> - include: …/…/some-other-role/handlers/main.yml

That works, thanks!  
Would be nice to see a solution that uses role\_path instead of assuming dir structure.
