Consider the following (reduced for brevity) playbook with a block and rescue block
- name: deploy block
block:
- name: debug meta
debug: var=meta
- name: create/update configmap with new data
k8s:
state: present
namespace: "{{ namespace }}"
definition: "{{ lookup('template', 'configmap.tpl.yml') }}"
kind: ConfigMap
notify:
- successfull_deployment_slack_handler
rescue:
- name: Something went wrong handler
debug:
msg: "Something has failed in the playbook"
notify: failure_deployment_slack_handler
- meta: flush_handlers
Testing this in the happy path works and calls the handlers as expected.
But when I fail the tasks in my testing I do see the expected debug message, but the actual handler isn't called (I've traded it for a debug message to verify).
Yes, I've tried adding meta: flush_handlers
.
How can I make this work?
Ansible version: 2.9.9