summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2019-02-25 09:30:17 +0100
committerGitHub <noreply@github.com>2019-02-25 09:30:17 +0100
commitf135960fc2e7572ce4e241b71cde64701a2d768c (patch)
tree16340cde20772a234b54beab26855d81ad1be3d1
parenta1ec307d43bee9a8dca641ae883fb6d55448909b (diff)
downloadansible-f135960fc2e7572ce4e241b71cde64701a2d768c.tar.gz
Clear failed state in always only if we did rescue (#52829)
Fixes #52561
-rw-r--r--changelogs/fragments/52561-fix-handlers-on-failed-hosts-with-always-section.yaml2
-rw-r--r--lib/ansible/executor/play_iterator.py2
2 files changed, 3 insertions, 1 deletions
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