mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-14 04:41:27 +00:00
doc: another block/rescue with flush_handlers (#15463)
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
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::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user