From d8baf4d38d9d2d2116f8d7b5272ed88b2f416c8a Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Tue, 17 Nov 2020 10:11:15 -0500 Subject: [PATCH] Document and warn when max_fail and free are used (#72616) Fixes #16666 --- changelogs/fragments/max_fail_free.yml | 2 ++ lib/ansible/keyword_desc.yml | 2 +- lib/ansible/plugins/strategy/free.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/max_fail_free.yml diff --git a/changelogs/fragments/max_fail_free.yml b/changelogs/fragments/max_fail_free.yml new file mode 100644 index 00000000000..dcaadbb6538 --- /dev/null +++ b/changelogs/fragments/max_fail_free.yml @@ -0,0 +1,2 @@ +bugfixes: + - Updated docs and added warning on max_fail_percentage and free strategy usage. fixes issue 16666. diff --git a/lib/ansible/keyword_desc.yml b/lib/ansible/keyword_desc.yml index 357f1d0ad6a..3139b5a6dd3 100644 --- a/lib/ansible/keyword_desc.yml +++ b/lib/ansible/keyword_desc.yml @@ -46,7 +46,7 @@ loop_control: | .. seealso:: :ref:`loop_control` -max_fail_percentage: can be used to abort the run after a given percentage of hosts in the current batch has failed. +max_fail_percentage: can be used to abort the run after a given percentage of hosts in the current batch has failed. This only wokrs on linear or linear derived strategies. module_defaults: Specifies default parameter values for modules. name: "Identifier. Can be used for documentation, or in tasks/handlers." no_log: Boolean that controls information disclosure. diff --git a/lib/ansible/plugins/strategy/free.py b/lib/ansible/plugins/strategy/free.py index 43fe9ef4c18..7e0406984d8 100644 --- a/lib/ansible/plugins/strategy/free.py +++ b/lib/ansible/plugins/strategy/free.py @@ -92,6 +92,9 @@ class StrategyModule(StrategyBase): self._set_hosts_cache(iterator._play) + if iterator._play.max_fail_percentage is not None: + display.warning("Using max_fail_percentage with the free strategy is not supported, as tasks are executed independently on each host") + work_to_do = True while work_to_do and not self._tqm._terminated: