Should something like the following work?
-
name: update file from templated
template: src=config.j2 dest=/etc/config
register: result -
name: run command if /etc/config changed
command: /usr/bin/command -option arg
when: result|changed
When I run the first task and the content of ‘/etc/config’ changes I get a changed status for the task. I the content of the file doesn’t change I get an ok status. So I would expect the above to work but it doesn’t, I simply get a Conditional expression must evaluate to True or False… fatal error.
Can someone clarify if it is by design that template module results can’t be registered? Is there a workaround for what I’m trying to achieve?
Thanks.