# Execution order of handles in notify

**URL:** <https://forum.ansible.com/t/execution-order-of-handles-in-notify/22002>\
**Category:** Ansible Project\
**Created:** [July 13, 2016, 8:25am UTC](https://forum.ansible.com/t/execution-order-of-handles-in-notify/22002 "2016-07-13T08:25:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [July 13, 2016, 8:25am UTC](https://forum.ansible.com/t/execution-order-of-handles-in-notify/22002/1 "2016-07-13T08:25:22Z")

</div>

Hi,

I can’t find anywhere in the documentation any mention of the task order executed under notify. Having the example from the web docs:

```auto
- name: template configuration file
  template: src=template.j2 dest=/etc/foo.conf
  notify:
     - restart memcached
     - restart apache

```

does this guarantee that memcached is always going to be restarted before apache when the handles get flushed?

Thanks,  
Igor

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 13, 2016, 9:20am UTC](https://forum.ansible.com/t/execution-order-of-handles-in-notify/22002/2 "2016-07-13T09:20:34Z")

</div>

No.  
All notify will run at the end an in the order they are in handlers file.

---

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [July 13, 2016, 10:29am UTC](https://forum.ansible.com/t/execution-order-of-handles-in-notify/22002/3 "2016-07-13T10:29:07Z")

</div>

I guess same goes in case of different tasks calling different handles? Like:

```auto
- task1
  notify:
     - restart memcached

- tasks2
  notify:
     - restart apache

```

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 13, 2016, 10:54am UTC](https://forum.ansible.com/t/execution-order-of-handles-in-notify/22002/4 "2016-07-13T10:54:50Z")

</div>

Yes.  
The order the handlers are being notify has no influence on the order they are executed.  
They will always be executed in the order they are in the handlers file.
