ansible-redis
ansible-redis copied to clipboard
"flush_handlers task does not support when conditional"
I have noticed this while upgrading to Ansible 2.7.12.
I am not sure yet what the implications are (e.g. is it already not flushing, when it should?).
TASK [DavidWittman.redis : add redis init config file] ***************************************************************************
ok: [the-machine]
[WARNING]: flush_handlers task does not support when conditional
If I understand well, the relevant bits are around here. Please note that I don't use sentinel on this install, but there's probably the same pattern used there.
https://github.com/DavidWittman/ansible-redis/blob/9d00d7a73b775f6d42f6941e50c89dccfc4f878c/tasks/server.yml#L112-L131
There is some input on the Ansible google group here, which seems to imply this has never worked (and failed silently before):
A when statement supplied to flush_handlers has never worked. It was silently ignored in the past, but now has a warning.
There is an open feature request to allow this to work: https://github.com/ansible/ansible/issues/41313
A quick update - I updated the role to latest (thanks for your work!) and wanted to report this warning still appears. Not a huge deal for me, just wanted to either close the issue or update it.
In order to resolve this, the flush_handlers action needs to be in a separate tasks file. Then, where flush_handlers is currently used, replace it with include_tasks leaving the when condition as is.