summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Xie <qduxiaoliang@163.com>2015-12-07 11:06:26 +0800
committerLeon Xie <qduxiaoliang@163.com>2015-12-07 16:48:11 +0800
commit0da8c8bdd532aebb04586c141b8baac1e23eb296 (patch)
tree7c1bcd765cc4dedb7285179585b31e59ed6c9bdf
parentab18fd2171482859bebc84072471fa086ea3489c (diff)
downloadansible-0da8c8bdd532aebb04586c141b8baac1e23eb296.tar.gz
quit plays with an error if there were failed tasks and handler execution is forced
-rw-r--r--lib/ansible/playbook/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py
index b9bf4251ec..0488e09685 100644
--- a/lib/ansible/playbook/__init__.py
+++ b/lib/ansible/playbook/__init__.py
@@ -826,6 +826,11 @@ class PlayBook(object):
# if there were failed tasks and handler execution
# is not forced, quit the play with an error
return False
+ elif task_errors:
+ # if there were failed tasks and handler execution is forced,
+ # execute all handlers and quit the play with an error
+ self.run_handlers(play)
+ return False
else:
# no errors, go ahead and execute all handlers
if not self.run_handlers(play):