# Multiple handler notifications with same handler name, only one is executed

**URL:** <https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545>\
**Category:** Ansible Project\
**Created:** [February 11, 2014, 8:26pm UTC](https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545 "2014-02-11T20:26:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Chavez](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Jose\_Chavez](https://forum.ansible.com/u/Jose_Chavez)\
**Post date:** [February 11, 2014, 8:26pm UTC](https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545/1 "2014-02-11T20:26:31Z")

</div>

Hello Ansible devs,

I seem to have hit a regression in Ansible 1.4.3. I have a very simple ansible playbook with one role and a handler file that contains two notification. The role calls notify against the name of the handlers (same name for both) but only the first handler is called. In Ansible 1.4.1 all handlers with the same name would be called. Could this be a bug?

Simple ansible playbook contents below:

playbook file: test\_handler\_problem.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:** [February 12, 2014, 2:54am UTC](https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545/2 "2014-02-12T02:54:34Z")

</div>

So my original response was:

So this is completely and totally a real thing, because the handlers are stored in a giant dictionary, by name.

We don’t make that a failure because if two roles define “restart apache” that shouldn’t be a conflict someone has to resolve, nor should Apache restart twice.

Then I read what you said about it being a regression. I’m not so sure, was it a regression, or was the behavior you suggested happened in 1.4.1 actually a bug? I’d argue it was, and it got fixed.

(That being said, if you do want multiple handlers and they are slightly different, you can in fact parameterize the name of the handler, and that will work – but it can’t use an inventory-scoped variable to do it. That’s also rarely done.)

---

<div class="post-metadata">

**Author:** ![Jose\_Chavez](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Jose\_Chavez](https://forum.ansible.com/u/Jose_Chavez)\
**Post date:** [February 12, 2014, 5:43pm UTC](https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545/3 "2014-02-12T17:43:25Z")

</div>

Hi Michael,

Could you give me an example of how I could accomplish this using parameterization? I basically just need to be able to have a role task call multiple notifications which in 1.4.1 was just one notify call to the same named handlers 🙂 I tried specifying multiple notify’s in the role task as well but it looks like only one is called there too.

---

<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:** [February 12, 2014, 5:46pm UTC](https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545/4 "2014-02-12T17:46:50Z")

</div>

This is what is available:

tasks:

- shell: foo {{ my\_port }}

notify:

- “some handler {{ my\_port }}”

handlers:

- name: “some handler 22”  
shell: bar
- name: “some handler 50”  
shell: baz

---

<div class="post-metadata">

**Author:** ![Jesse\_Keating](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@Jesse\_Keating](https://forum.ansible.com/u/Jesse_Keating)\
**Post date:** [February 12, 2014, 6:04pm UTC](https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545/5 "2014-02-12T18:04:55Z")

</div>

You can notify more than one handler

notify:  
&nbsp;&nbsp;&nbsp;- handler 1  
&nbsp;&nbsp;&nbsp;- handler 2

-jlk

---

<div class="post-metadata">

**Author:** ![Jose\_Chavez](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Jose\_Chavez](https://forum.ansible.com/u/Jose_Chavez)\
**Post date:** [February 12, 2014, 6:24pm UTC](https://forum.ansible.com/t/multiple-handler-notifications-with-same-handler-name-only-one-is-executed/14545/6 "2014-02-12T18:24:08Z")

</div>

thanks Jesse. I see where I went wrong.
