I have handlers in my Ansible playbook and I want to trigger these notifies immediately. How can this be achieved without calling the meta_handler = flush_handler
?
This works fine in Ansible 2.5.6 but after this version there is a warning displayed saying:
[WARNING]: flush_handlers task does not support when conditional
Any help would be appreciated.
It's an open issue meta: flush_handlers doesn't honor when clause #41313.
(2021-04-20 the issue is still open. Please comment here if status changes)
Quoting my comment:
Let me describe a valid scenario (below). "flush_hadlers" is needed after tasks abc.yml complete and before tasks def.yml start. But the file with the tasks xyz.yml is imported when OS is RH only. Here Ansible complains:
[WARNING]: flush_handlers task does not support when conditional
It would be nice to be able to suppress the warning.
# cat xyz.yml
- include_tasks: abc.yml
- meta: flush_handlers
- include_tasks: def.yml
# cat playbook.yml
...
tasks:
- import_tasks: xyz.yml
when: (ansible_os_family == "RedHat" )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With