From 61901c35e15d6ec637008130abd423e12a4ecb0a Mon Sep 17 00:00:00 2001 From: Alicia Cozine Date: Tue, 31 Jul 2018 09:26:42 -0500 Subject: [PATCH] document rescue vars (#43101) (#43457) (cherry picked from commit c809500c7940d54c7cd320d86508d87e4100d779) --- docs/docsite/rst/user_guide/playbooks_blocks.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/docsite/rst/user_guide/playbooks_blocks.rst b/docs/docsite/rst/user_guide/playbooks_blocks.rst index 3383b54368a..e68ae1ee81c 100644 --- a/docs/docsite/rst/user_guide/playbooks_blocks.rst +++ b/docs/docsite/rst/user_guide/playbooks_blocks.rst @@ -95,6 +95,17 @@ Another example is how to run handlers after an error occurred : debug: 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:: :doc:`playbooks`