We have a role that's designed to install & configure nagios in one of our
myriad environments. I'm in the process of getting it to work in a new
environment. One of the tasks in this role installs a bunch of common
nagios check scripts via a with_items loop in a pretty straightforward
manner:
- name: template custom plugins
template: dest=/usr/lib64/nagios/plugins/{{ item }} src={{ item }}
mode=0755 owner=root group=root
with_items:
- check_api
...
- check_neo4j_replication
Since all these scripts are templated it means they each have variables in
them that need to be resolved by Ansible. Some of these variables simply
don't exist in our new environment so I want to skip installing those
scripts. To that end I rewrote the task as outlined
here: https://gist.github.com/bpennypacker/bba41d293bb23134b82e
With the rewritten task it runs properly, however it also now causes
Ansible to throw a warning:
[WARNING]: It is unnecessary to use '{{' in conditionals, leave variables
in loop expressions bare.
If I change the 'when' clause from when: "{{ item.when }}" to just when:
item.when then I no longer get the warning, but Ansible also doesn't
interpret the conditionals properly. They always resolve to true, so the
task tries to install the templates and subsequently fails because the
associated variables don't exist.
My question: Would it be considered a bug that Ansible is parsing when: "{{
item.when }}" properly but not when: item.when ?
Thanks,
-Bruce
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7257cbd6-8764-479e-88fb-74de19227823%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.