Skip to content

Commit

Permalink
Clarify handlers with the same name behavior (#219)
Browse files Browse the repository at this point in the history
Co-authored-by: Don Naro <[email protected]>
  • Loading branch information
mkrizek and oraNod authored Aug 25, 2023
1 parent 96807c2 commit 1a53b5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/docsite/rst/playbook_guide/playbooks_handlers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ In this example playbook, the Apache server is restarted by the handler after al
Notifying handlers
------------------

Tasks can instruct one or more handlers to execute using the ``notify`` keyword. The ``notify`` keyword can be applied to a task and accepts a list of handler names that are notified on a task change. Alternately, a string containing a single handler name can be supplied as well. The following example demonstrates how multiple handlers can be notified by a single task:
Tasks can instruct one or more handlers to execute using the ``notify`` keyword. The ``notify`` keyword can be applied to a task and accepts a list of handler names that are notified on a task change. Alternatively, a string containing a single handler name can be supplied as well. The following example demonstrates how multiple handlers can be notified by a single task:

.. code-block:: yaml
Expand Down Expand Up @@ -110,7 +110,7 @@ Notifying the ``restart web services`` topic results in executing all handlers l

This use makes it much easier to trigger multiple handlers. It also decouples handlers from their names, making it easier to share handlers among playbooks and roles (especially when using third-party roles from a shared source such as Ansible Galaxy).

Each handler should have a globally unique name. If multiple handlers are defined with the same name, only the last one defined is notified with ``notify``, effectively shadowing all of the previous handlers with the same name. Alternately handlers sharing the same name can all be notified and executed if they listen on the same topic by notifying that topic.
Each handler should have a globally unique name. If multiple handlers are defined with the same name, only the last one loaded into the play can be notified and executed, effectively shadowing all of the previous handlers with the same name.

There is only one global scope for handlers (handler names and listen topics) regardless of where the handlers are defined. This also includes handlers defined in roles.

Expand Down

0 comments on commit 1a53b5a

Please sign in to comment.