From f135960fc2e7572ce4e241b71cde64701a2d768c Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Mon, 25 Feb 2019 09:30:17 +0100 Subject: [PATCH] Clear failed state in always only if we did rescue (#52829) Fixes #52561 --- .../52561-fix-handlers-on-failed-hosts-with-always-section.yaml | 2 ++ lib/ansible/executor/play_iterator.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/52561-fix-handlers-on-failed-hosts-with-always-section.yaml diff --git a/changelogs/fragments/52561-fix-handlers-on-failed-hosts-with-always-section.yaml b/changelogs/fragments/52561-fix-handlers-on-failed-hosts-with-always-section.yaml new file mode 100644 index 0000000000..36e7cd4a6b --- /dev/null +++ b/changelogs/fragments/52561-fix-handlers-on-failed-hosts-with-always-section.yaml @@ -0,0 +1,2 @@ +bugfixes: + - Fix handlers on failed hosts with always section (https://github.com/ansible/ansible/issues/52561) diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py index ab40ce6723..63e4811789 100644 --- a/lib/ansible/executor/play_iterator.py +++ b/lib/ansible/executor/play_iterator.py @@ -484,7 +484,7 @@ class PlayIterator: elif state.fail_state != self.FAILED_NONE: if state.run_state == self.ITERATING_RESCUE and state.fail_state & self.FAILED_RESCUE == 0: return False - elif state.run_state == self.ITERATING_ALWAYS and state.fail_state & self.FAILED_ALWAYS == 0: + elif state.run_state == self.ITERATING_ALWAYS and state.fail_state & self.FAILED_ALWAYS == 0 and state.did_rescue: return False else: return not state.did_rescue