We’ve had a snippet, a comment really, floating around our shop for a long time, to wit:
# This task file is included by the "soft" handler b/c
# handlers can't deal with `when:` etc.
I suspect it was born of empirical evidence from a when:
expression that used an undefined variable and we were just learning Ansible. My guess is that, instead of the “define all variables or provide defaults” lesson, somebody leapt to the wrong conclusion that “handlers can’t deal with when:
”.
The only restriction I see in the docs on handlers is a prohibition on their use of import_role
or include_role
. We just had an embarrassing oops in production because of this comment, and I’d like to settle this once and for all.
So, is there anything “special” about when:
on handlers? [Hoping for a resounding “No.”]