# Notifying handler only once

**URL:** <https://forum.ansible.com/t/notifying-handler-only-once/14949>\
**Category:** Ansible Project\
**Created:** [April 6, 2014, 9:31pm UTC](https://forum.ansible.com/t/notifying-handler-only-once/14949 "2014-04-06T21:31:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacob\_Weber1](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Jacob\_Weber1](https://forum.ansible.com/u/Jacob_Weber1)\
**Post date:** [April 6, 2014, 9:31pm UTC](https://forum.ansible.com/t/notifying-handler-only-once/14949/1 "2014-04-06T21:31:07Z")

</div>

Is there a way to have multiple plays call a “notify” handler, but have the handler run only once, at the end of all plays?

For example, say I have site.yml:

- include webservers.yml
- include database.yml

And in both webservers.yml and database.yml, I have a role that calls:  
notify: update load balancer

If I put an “update load balancer” handler in some common role included by both webservers.yml and database.yml, it gets called at the end of each of those two plays. I only want it to happen once, at the end of both plays.

And if I put the handler inside site.yml, it can’t be found by the included plays.

Thanks.

---

<div class="post-metadata">

**Author:** ![Timur\_Batyrshin](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@Timur\_Batyrshin](https://forum.ansible.com/u/Timur_Batyrshin)\
**Post date:** [April 8, 2014, 5:44am UTC](https://forum.ansible.com/t/notifying-handler-only-once/14949/2 "2014-04-08T05:44:37Z")

</div>

Hi,

I’ve posted a similar message earlier: [https://groups.google.com/forum/#!topic/ansible-project/8FqZwqqyyeU](https://groups.google.com/forum/#!topic/ansible-project/8FqZwqqyyeU)  
But haven’t got any replies to it.

And here is a bit earlier ticket with Michael’s answer: [https://github.com/ansible/ansible/issues/5634](https://github.com/ansible/ansible/issues/5634)

If you find the way to solve your issue please let us know here, as I’m interested in that too.

Thanks,  
Timur

---

<div class="post-metadata">

**Author:** ![Aaron\_Hunter](https://avatars.discourse-cdn.com/v4/letter/a/e19adc/32.png) [@Aaron\_Hunter](https://forum.ansible.com/u/Aaron_Hunter)\
**Post date:** [April 8, 2014, 6:27pm UTC](https://forum.ansible.com/t/notifying-handler-only-once/14949/3 "2014-04-08T18:27:39Z")

</div>

I would like the same thing. I think Ansible needs a global handler and global notify. This would support the frequently used unix conf.d/ idiom. Right now the way I do it is with a role called “end” that does the restart. You lose idempotency because it always runs (it has to due to no global notify) but it works.

-Aaron

---

<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:** [April 9, 2014, 1:57pm UTC](https://forum.ansible.com/t/notifying-handler-only-once/14949/4 "2014-04-09T13:57:28Z")

</div>

It’s very unlikely that we are going to add a handler that spans plays, due to the way plays are modelled.

However, there are some tricks/patterns where you could create a “handler needs to run” file on the remote host, check for it with stat, and signal a handler in a final play, if you were using more than one play.
