# Triggering handlers from role dependency

**URL:** <https://forum.ansible.com/t/triggering-handlers-from-role-dependency/18960>\
**Category:** Ansible Project\
**Created:** [August 6, 2015, 9:05am UTC](https://forum.ansible.com/t/triggering-handlers-from-role-dependency/18960 "2015-08-06T09:05:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike6](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@mike6](https://forum.ansible.com/u/mike6)\
**Post date:** [August 6, 2015, 9:05am UTC](https://forum.ansible.com/t/triggering-handlers-from-role-dependency/18960/1 "2015-08-06T09:05:38Z")

</div>

Hi,

I’m trying to find out what would be the best way to trigger a handler if something in a role dependency changed.

The scenario is quite common I think, and goes like this:

- Role jvm
- Role application1 (depending on jvm)
- Role application2 (depending on jvm)

If the JVM gets updated, application1 and 2 should be restarted, but obviously the jvm role cannot know about all the applications that depend on it.

Ideally, I would simple put a ‘notify: jvm updated’ in the JVM role, which triggers handlers in the application roles. Another option may be to register a variable jvm\_updated in the JVM role, which is checked by the application roles (but in this case, I do not really know how to trigger a handler conditionally in a role, without a task which actually triggers the handler).

What would be a good way to implement this, any suggestions?

Many thanks,

Mike
