|
|
@ -95,6 +95,17 @@ Another example is how to run handlers after an error occurred :
|
|
|
|
debug:
|
|
|
|
debug:
|
|
|
|
msg: 'This handler runs even on error'
|
|
|
|
msg: 'This handler runs even on error'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ansible also provides a couple of variables for tasks in the ``rescue`` portion of a block:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ansible_failed_task
|
|
|
|
|
|
|
|
The task that returned 'failed' and triggered the rescue. For example, to get the name use ``ansible_failed_task.name``.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ansible_failed_result
|
|
|
|
|
|
|
|
The captured return result of the failed task that triggered the rescue. This would equate to having used this var in the ``register`` keyword.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
|
|
|
|
:doc:`playbooks`
|
|
|
|
:doc:`playbooks`
|
|
|
|