LOGBOOK

HELP

Quiz Entry - updated: 2026.11.12

In which order do notified handlers run?

In the order they are written in the handlers: section, not the order of the notify list and not the order in which tasks notified them.

Notify order restart apache then restart mysql, but the handlers section lists mysql first, so mysql runs first

* The handlers section sets the order; notify only says which ones run. *

Notification only marks a handler as "needs to run". When the handlers are flushed, Ansible walks through the handlers: section from top to bottom and runs each marked one.

So if a task has notify: [restart apache, restart mysql] but the section defines restart mysql first, MariaDB is restarted before Apache. If one service must come up before another (the database before the web application that connects to it), put the handlers in that order in the section. Rearranging notify lists changes nothing.

Go deeper:

From Quiz: ITIA / Ansible Task Control: Loops, Conditionals, Handlers and Error Handling | Updated: Nov 12, 2026