"flush_handlers task does not support when conditional"...??

1,534 views
Skip to first unread message

Frank Thommen

unread,
Nov 29, 2018, 2:09:53 PM11/29/18
to Ansible Project
Hello,

our latest yum update brought ansible from 2.4.2.0 to 2.7.2 and now we
are facing

[WARNING]: flush_handlers task does not support when conditional

we need the handlers to be flushed at that point, as later tasks rely on
previously reconfigured services to be reloaded. The "when" originates
from our role definition:

----------------------
- hosts: all
name: "====== BLAH ======"
roles:
- { role: blah, when: has_blah|default(False) }
tags:
- blah-only
----------------------
(has_blah is an inventory variable, the hosts which "have blah" are
spread over all our host groups. To organize them in a separate host
group would be too much overhead as this characteristic can change very
often).

I can't find this restriction mentioned anywhere in the changelogs or
the documentation of handlers or "meta" and I wonder

a) why this - IMHO irritating - change of behaviour has been introduced

and

b) what would be the best way to work around it


Any help or hint is appreciated.


frank


Matt Martz

unread,
Nov 29, 2018, 2:15:54 PM11/29/18
to ansible...@googlegroups.com
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: 


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f9ecce8b-2c47-472d-ad1e-9074f3894070%40drosera.ch.
For more options, visit https://groups.google.com/d/optout.
--
Matt Martz
@sivel
sivel.net

Frank Thommen

unread,
Nov 29, 2018, 2:27:40 PM11/29/18
to ansible...@googlegroups.com
Hmm. That would explain some random issues that we had in the past with
this playbook
> <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> To post to this group, send email to
> ansible...@googlegroups.com
> <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f9ecce8b-2c47-472d-ad1e-9074f3894070%40drosera.ch.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Matt Martz
> @sivel
> sivel.net <http://sivel.net>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ansible-proje...@googlegroups.com
> <mailto:ansible-proje...@googlegroups.com>.
> To post to this group, send email to ansible...@googlegroups.com
> <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAD8N0v95xvMwYZmJP0Lqh%3Drq3rxeDiEg4xCXB%3Dp09yFVra1z-A%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAD8N0v95xvMwYZmJP0Lqh%3Drq3rxeDiEg4xCXB%3Dp09yFVra1z-A%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages