# Trigger \`notify\` events at a given point.

**URL:** <https://forum.ansible.com/t/trigger-notify-events-at-a-given-point/12124>\
**Category:** Ansible Project\
**Created:** [December 6, 2012, 6:50pm UTC](https://forum.ansible.com/t/trigger-notify-events-at-a-given-point/12124 "2012-12-06T18:50:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre\_Bourget1](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Alexandre\_Bourget1](https://forum.ansible.com/u/Alexandre_Bourget1)\
**Post date:** [December 6, 2012, 6:50pm UTC](https://forum.ansible.com/t/trigger-notify-events-at-a-given-point/12124/1 "2012-12-06T18:50:09Z")

</div>

Hi community,

thanks again for the great project 🙂

I was thinking of my usage of `notify` and `handlers`. I don’t use them much and I find myself rewriting the pattern by inserting some “restart” actions in the middle of my tasks. And then, I also write some “changes detectors” to run those restarts conditionally… kind of re-doing what the notify / handlers does.

Why am I not using the notify / handlers, then ? It’s because I can’t control where and when it’s going to be handled… What would fit my use case, would be to have something like:

- name: Trigger restarts  
action: apply\_notifies

or

- apply\_notifies: $item  
with\_items:
- restart this service
- restart that service

and then, _if it was notified_ only… it would run that handler.

Would that be complex to build, or useful to any ?

Thanks!

Alexandre

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [December 6, 2012, 7:21pm UTC](https://forum.ansible.com/t/trigger-notify-events-at-a-given-point/12124/2 "2012-12-06T19:21:53Z")

</div>

There have been many discussions on notify/handlers, some of them overlap with what you are asking for here, I’m not sure where the state of them are (check this list and github issues).

I currently lack the time, but would like to implement ‘immediate’, ‘on error’, ‘if x fail/succeed’, notify: [list] and other options, but it is hard to design in a way that fits well in ansible.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [December 7, 2012, 4:16pm UTC](https://forum.ansible.com/t/trigger-notify-events-at-a-given-point/12124/3 "2012-12-07T16:16:03Z")

</div>

In general I don't want to see the handler logic greatly expanded, and  
I don't like the proposed syntax.

One way you can deal with this is to use "ignore\_errors: True" and  
then deal with the error condition in an 'only\_if' or 'when\_boolean'  
statement right after it.
