Explain uniqueness requrement for handler task names.

This commit is contained in:
Marc Tamsky 2015-07-18 23:36:01 -07:00
parent 7a9b5b6fe8
commit 2724adf18e

View file

@ -365,10 +365,10 @@ The things listed in the 'notify' section of a task are called
handlers. handlers.
Handlers are lists of tasks, not really any different from regular Handlers are lists of tasks, not really any different from regular
tasks, that are referenced by name. Handlers are what notifiers tasks, that are referenced by a globally unique name. Handlers are
notify. If nothing notifies a handler, it will not run. Regardless what notifiers notify. If nothing notifies a handler, it will not
of how many things notify a handler, it will run only once, after all run. Regardless of how many things notify a handler, it will run only
of the tasks complete in a particular play. once, after all of the tasks complete in a particular play.
Here's an example handlers section:: Here's an example handlers section::
@ -382,7 +382,10 @@ Handlers are best used to restart services and trigger reboots. You probably
won't need them for much else. won't need them for much else.
.. note:: .. note::
Notify handlers are always run in the order written. * Notify handlers are always run in the order written.
* Handler names live in a global namespace.
* If two handler tasks have the same name, only one will run.
`* <https://github.com/ansible/ansible/issues/4943>`_
Roles are described later on. It's worthwhile to point out that handlers are Roles are described later on. It's worthwhile to point out that handlers are
automatically processed between 'pre_tasks', 'roles', 'tasks', and 'post_tasks' automatically processed between 'pre_tasks', 'roles', 'tasks', and 'post_tasks'