Maybe i was not precise enough. Situation is this:
If the var is defined it looks like this:
FIREWALLD_ZONE_SERVICE:
- ZONE: public
SERVICES:
- SERVICE: http
STATE: enabled
- SERVICE: https
STATE: enabled
We loop through SERVICES with
FIREWALLD_ZONE_SERVICE|subelements('SERVICES')
This is fine as long the var is defined. It not we expect that
when: FIREWALLD_ZONE_SERVICE is defined
prevents the evaluation of the war in the loop.
In another context it works fine:
loop: "{{ FIREWALLD_ZONE|product(FIREWALLD_ZONE.ZONES)|list }}"
when: FIREWALLD_ZONE is defined
If FIREWALLD_ZONE is not defined the var in the loop is not evaluated.
So the difference is:
If we have 'subelements' in the loop 'when: var is defined' is not working.
If we have eq. 'product' in the loop 'when: var is defined' works.
More clear now? :-)
Could someone spend some thoughts? Maybe it is a misunderstanding on our
site...
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/92eb146a-4389-4ab5-9606-1a03f258fed9%40googlegroups.com.