mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-21 19:43:59 -07:00
Fix --force-handlers, and allow it in plays and ansible.cfg
The --force-handlers command line argument was not correctly running handlers on hosts which had tasks that later failed. This corrects that, and also allows you to specify force_handlers in ansible.cfg or in a play.
This commit is contained in:
parent
e6fa169a05
commit
652cd6cd5e
11 changed files with 123 additions and 12 deletions
|
@ -29,6 +29,26 @@ write a task that looks like this::
|
|||
Note that the above system only governs the failure of the particular task, so if you have an undefined
|
||||
variable used, it will still raise an error that users will need to address.
|
||||
|
||||
.. _handlers_and_failure:
|
||||
|
||||
Handlers and Failure
|
||||
````````````````````
|
||||
|
||||
.. versionadded:: 1.9.1
|
||||
|
||||
When a task fails on a host, handlers which were previously notified
|
||||
will *not* be run on that host. This can lead to cases where an unrelated failure
|
||||
can leave a host in an unexpected state. For example, a task could update
|
||||
a configuration file and notify a handler to restart some service. If a
|
||||
task later on in the same play fails, the service will not be restarted despite
|
||||
the configuration change.
|
||||
|
||||
You can change this behavior with the ``--force-handlers`` command-line option,
|
||||
or by including ``force_handlers: True`` in a play, or ``force_handlers = True``
|
||||
in ansible.cfg. When handlers are forced, they will run when notified even
|
||||
if a task fails on that host. (Note that certain errors could still prevent
|
||||
the handler from running, such as a host becoming unreachable.)
|
||||
|
||||
.. _controlling_what_defines_failure:
|
||||
|
||||
Controlling What Defines Failure
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue