mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
doc: another block/rescue with flush_handlers (#15463)
This commit is contained in:
parent
cfe99b991f
commit
ff0296f98a
1 changed files with 17 additions and 0 deletions
|
@ -61,6 +61,23 @@ with whatever you need to do to recover from the previous error. The ``always``
|
||||||
error did or did not occur in the ``block`` and ``rescue`` sections.
|
error did or did not occur in the ``block`` and ``rescue`` sections.
|
||||||
|
|
||||||
|
|
||||||
|
Another example is how to run handlers after an error occurred :
|
||||||
|
|
||||||
|
.. code-block:: YAML
|
||||||
|
:emphasize-lines: 4,8
|
||||||
|
:caption: Block run handlers in error handling
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- block:
|
||||||
|
- debug: msg='i execute normally'
|
||||||
|
notify: run me even after an error
|
||||||
|
- command: /bin/false
|
||||||
|
rescue:
|
||||||
|
- name: make sure all handlers run
|
||||||
|
meta: flush_handlers
|
||||||
|
handlers:
|
||||||
|
- name: run me even after an error
|
||||||
|
debug: msg='this handler runs even on error'
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue