# Handler's execution order is unintuitive and misleading when reading through a set of tasks and trying to reason about execution flow.

**URL:** <https://forum.ansible.com/t/handlers-execution-order-is-unintuitive-and-misleading-when-reading-through-a-set-of-tasks-and-trying-to-reason-about-execution-flow/25485>\
**Category:** Ansible Project\
**Created:** [September 14, 2017, 3:51pm UTC](https://forum.ansible.com/t/handlers-execution-order-is-unintuitive-and-misleading-when-reading-through-a-set-of-tasks-and-trying-to-reason-about-execution-flow/25485 "2017-09-14T15:51:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![camilo.aguilar](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@camilo.aguilar](https://forum.ansible.com/u/camilo.aguilar)\
**Post date:** [September 14, 2017, 3:51pm UTC](https://forum.ansible.com/t/handlers-execution-order-is-unintuitive-and-misleading-when-reading-through-a-set-of-tasks-and-trying-to-reason-about-execution-flow/25485/1 "2017-09-14T15:51:52Z")

</div>

One would normally think `notify` statements will get queued up and dequeued at the end of the playbook run, in the same order they were notified.  
However, that doesn’t seem to happen. Instead, they get executed in the order in which they were defined in the handler’s yaml file.

Is this behavior by design?

---

<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:** [September 14, 2017, 4:35pm UTC](https://forum.ansible.com/t/handlers-execution-order-is-unintuitive-and-misleading-when-reading-through-a-set-of-tasks-and-trying-to-reason-about-execution-flow/25485/2 "2017-09-14T16:35:23Z")

</div>

Yes, you can read more about it here  
[https://docs.ansible.com/ansible/latest/playbooks\_intro.html#handlers-running-operations-on-change](https://docs.ansible.com/ansible/latest/playbooks_intro.html#handlers-running-operations-on-change)

I'm not agree with it been unintuitive or misleading, in my view it's one of Ansible's strength.  
But you need to check the handlers to see it's order, it you would like to have the order you can always named them with a number that indicate the order.

---

<div class="post-metadata">

**Author:** ![camilo.aguilar](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@camilo.aguilar](https://forum.ansible.com/u/camilo.aguilar)\
**Post date:** [September 14, 2017, 4:40pm UTC](https://forum.ansible.com/t/handlers-execution-order-is-unintuitive-and-misleading-when-reading-through-a-set-of-tasks-and-trying-to-reason-about-execution-flow/25485/3 "2017-09-14T16:40:57Z")

</div>

ah cool! whether we agree or not, it is at least documented 🙂 Thanks Kai!
