Greetings,
I’m running into unexpected behavior when trying to use a when_changed statement to trigger an immediate service reload if a change is made. We wanted to do this instead of doing a flush_handlers to avoid impacting the timing handlers that were triggered by other plays.
The following set of tasks in a role:
Does this happen if you use the new syntax of “when: result.changed”?
Looks like it works with the new syntax. I didn’t even see a mention to that in the docs. Must have slipped by me.
So BTW, this is wrong:
when_changed: $result
Do this:
when_changed: result
You only need to say “{{ foo }}” when you are forcing getting a string somewhere, and should never be using old style variables.
Also, a bit confused here by the topic.
“changed_when” is a thing that controls when something reports changed or not.
“when” is something that decides if something executes or not
“when: foo.changed” is a thing
you can also say
“when: foo|changed” and this better works with tasks that might be skipped, etc, and doesn’t require them to have a “.changed” attribute.
There is no “when_changed”