Skip to content

Instantly share code, notes, and snippets.

@jctanner
Last active August 29, 2015 13:57
Show Gist options
  • Save jctanner/9755105 to your computer and use it in GitHub Desktop.
Save jctanner/9755105 to your computer and use it in GitHub Desktop.
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py
index 779f300..8728965 100644
--- a/lib/ansible/playbook/__init__.py
+++ b/lib/ansible/playbook/__init__.py
@@ -601,6 +601,7 @@ class PlayBook(object):
play_hosts.append(all_hosts.pop())
serialized_batch.append(play_hosts)
+ task_errors = False
for on_hosts in serialized_batch:
# restrict the play to just the hosts we have in our on_hosts block that are
@@ -657,16 +658,18 @@ class PlayBook(object):
# if no hosts remain, drop out
if not host_list:
if self.force_handlers:
- if not self.run_handlers(play):
- return False
+ task_errors == True
+ break
else:
- self.callbacks.on_no_hosts_remaining()
- return False
- else:
- self.inventory.lift_also_restriction()
- if not self.run_handlers(play):
return False
+ if task_errors and not self.force_handlers:
+ return False
+ else:
+ self.inventory.lift_also_restriction()
+ if not self.run_handlers(play):
+ return False
+
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment