# Getting handlers to run in-between roles

**URL:** <https://forum.ansible.com/t/getting-handlers-to-run-in-between-roles/18378>\
**Category:** Ansible Project\
**Created:** [June 2, 2015, 8:28am UTC](https://forum.ansible.com/t/getting-handlers-to-run-in-between-roles/18378 "2015-06-02T08:28:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toby\_Corkindale](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toby\_Corkindale](https://forum.ansible.com/u/Toby_Corkindale)\
**Post date:** [June 2, 2015, 8:28am UTC](https://forum.ansible.com/t/getting-handlers-to-run-in-between-roles/18378/1 "2015-06-02T08:28:27Z")

</div>

Hi,  
I must be doing something wrong, but I don’t understand what.  
I want notified handlers to run between one role and the next. From reading other posts here, it seems that is how it is supposed to work, but it’s not what I’m seeing.

A simplified version of my playbook layout is like this:

playbook.yml - this contains one role, Wholemeal.

Wholemeal/meta/main.yml – this contains one role as a dependency, Sourdough.  
Wholemeal/tasks/main.yml – this contains some stuff that won’t work until the Sourdough handler, below, has restarted something.

Sourdough/tasks/main.yml – installs a configuration, notifies a service to restart.  
Sourdough/handlers/main.yml – has the notify handler to restart the service

When I run ansible-playbook playbook.yml, I see it run the Sourdough tasks first, then immediately the Wholemeal tasks, and only after them does it run the Sourdough-notified handler ☹

Is there a way to get this handler to run between the two roles?  
Keeping in mind that I only want to run it if the config file was changed, not _every_ time…

Thanks in advance,  
Toby

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 2, 2015, 1:52pm UTC](https://forum.ansible.com/t/getting-handlers-to-run-in-between-roles/18378/2 "2015-06-02T13:52:16Z")

</div>

last task in each role:

meta: flush-handlers

---

<div class="post-metadata">

**Author:** ![Toby\_Corkindale](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toby\_Corkindale](https://forum.ansible.com/u/Toby_Corkindale)\
**Post date:** [June 3, 2015, 12:43am UTC](https://forum.ansible.com/t/getting-handlers-to-run-in-between-roles/18378/3 "2015-06-03T00:43:22Z")

</div>

Hi  
That didn’t work, but you put me on the right path – it needed to be  
meta: flush\_handlers  
(note underscore instead of dash)

Thanks, appreciate the help,  
Toby

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [June 3, 2015, 3:42am UTC](https://forum.ansible.com/t/getting-handlers-to-run-in-between-roles/18378/4 "2015-06-03T03:42:18Z")

</div>

sorry for mislead, I need to have my email clients start validating my  
code blurbs.
