From 227f24f07eefea8421b805dad25305e178a83063 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Sat, 1 Oct 2016 14:02:36 +0100 Subject: [PATCH] Always force handler execution When a task fails in a playbook, the default behaviour results in notified handlers not running. This can result in a configuration change being executed, but the service not being restarted. This patch changes the default behaviour to force the handlers to run when a playbook fails for any reason except a host being unreachable. Change-Id: I8a16bb1a5c04345e962ab01225f3d972781d9ed7 Reference: http://docs.ansible.com/ansible/playbooks_error_handling.html#handlers-and-failure --- .../notes/ansible-force-handlers-1e00c9a88c29fe4f.yaml | 8 ++++++++ scripts/openstack-ansible.rc | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 releasenotes/notes/ansible-force-handlers-1e00c9a88c29fe4f.yaml diff --git a/releasenotes/notes/ansible-force-handlers-1e00c9a88c29fe4f.yaml b/releasenotes/notes/ansible-force-handlers-1e00c9a88c29fe4f.yaml new file mode 100644 index 0000000000..c8ef33114d --- /dev/null +++ b/releasenotes/notes/ansible-force-handlers-1e00c9a88c29fe4f.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - When a task fails while executing a playbook, the default behaviour for + Ansible is to fail for that host without executing any notifiers. This can + result in configuration changes being executed, but services not being + restarted. OpenStack-Ansible now sets ``ANSIBLE_FORCE_HANDLERS`` to + ``True`` by default to ensure that all notified handlers attempt to + execute before stopping the playbook execution. diff --git a/scripts/openstack-ansible.rc b/scripts/openstack-ansible.rc index 3ee0eba3c2..c1a91b2955 100644 --- a/scripts/openstack-ansible.rc +++ b/scripts/openstack-ansible.rc @@ -47,3 +47,5 @@ export ANSIBLE_SSH_PIPELINING="${ANSIBLE_SSH_PIPELINING:-True}" export ANSIBLE_STRATEGY_PLUGINS="${ANSIBLE_STRATEGY_PLUGINS:-/etc/ansible/roles/plugins/strategy}" export ANSIBLE_CONNECTION_PLUGINS="${ANSIBLE_CONNECTION_PLUGINS:-/etc/ansible/roles/plugins/connection}" + +export ANSIBLE_FORCE_HANDLERS="${ANSIBLE_FORCE_HANDLERS:-True}"