From 7e1060c716c4d7d3c5f5323895abc5a13d79ddb9 Mon Sep 17 00:00:00 2001 From: Sloane Hertel Date: Thu, 12 Sep 2019 16:15:02 -0400 Subject: [PATCH] Add some details to any_errors_fatal documentation (#62029) (cherry picked from commit 09f1c286e00828294802623da4a6b4880ec279a5) --- docs/docsite/rst/user_guide/playbooks_delegation.rst | 2 +- docs/docsite/rst/user_guide/playbooks_error_handling.rst | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/docsite/rst/user_guide/playbooks_delegation.rst b/docs/docsite/rst/user_guide/playbooks_delegation.rst index bcdbda3f933..212ef670013 100644 --- a/docs/docsite/rst/user_guide/playbooks_delegation.rst +++ b/docs/docsite/rst/user_guide/playbooks_delegation.rst @@ -312,7 +312,7 @@ use the default remote connection type:: Interrupt execution on any error ```````````````````````````````` -With the ''any_errors_fatal'' option, any failure on any host in a multi-host play will be treated as fatal and Ansible will exit immediately without waiting for the other hosts. +With the ''any_errors_fatal'' option, any failure on any host in a multi-host play will be treated as fatal and Ansible will exit as soon as all hosts in the current batch have finished the fatal task. Subsequent tasks and plays will not be executed. You can recover from what would be a fatal error by adding a rescue section to the block. Sometimes ''serial'' execution is unsuitable; the number of hosts is unpredictable (because of dynamic inventory) and speed is crucial (simultaneous execution is required), but all tasks must be 100% successful to continue playbook execution. diff --git a/docs/docsite/rst/user_guide/playbooks_error_handling.rst b/docs/docsite/rst/user_guide/playbooks_error_handling.rst index 38acea16214..6349f8cec44 100644 --- a/docs/docsite/rst/user_guide/playbooks_error_handling.rst +++ b/docs/docsite/rst/user_guide/playbooks_error_handling.rst @@ -152,13 +152,19 @@ Aborting the play Sometimes it's desirable to abort the entire play on failure, not just skip remaining tasks for a host. -The ``any_errors_fatal`` play option will end the play when any tasks results in an error and stop execution of the play:: +The ``any_errors_fatal`` option will end the play and prevent any subsequent plays from running. When an error is encountered, all hosts in the current batch are given the opportunity to finish the fatal task and then the execution of the play stops. ``any_errors_fatal`` can be set at the play or block level:: - hosts: somehosts any_errors_fatal: true roles: - myrole + - hosts: somehosts + tasks: + - block: + - include_tasks: mytasks.yml + any_errors_fatal: true + for finer-grained control ``max_fail_percentage`` can be used to abort the run after a given percentage of hosts has failed. Using blocks