Triggering handlers from role dependency

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