DL> In this case, there were no existing files, so the variable is empty
DL> and I would expect this *Clean rules* task to be skipped
Hmm, isn't the real problem that after the first task, exiting_rules
*isn't* undefined any more?
Add a debug task (- debug: var=existing_rules), and I see things l
If you read a little further down, under the "Loops and Conditionals"[1]
this information is present:
Combining when with with_items (see Loops), be aware that the when
> statement is processed separately for each item... If you need to skip the
> whole task depending on the loop variable being de
Thanks for the info Matt. The Ansible
docs, http://docs.ansible.com/ansible/playbooks_conditionals.html, indicate
this is should work as before. Specifically,
>
> If a required variable has not been set, you can skip or fail using
> Jinja2’s defined test. For example:
>
> tasks:
> - shell:
In 2.1 this would have been a deprecation warning. What you need is
something like:
with_items: "{{ existing_rules.files | default([]) | map(attribute='path')
| list }}"
That gives existing_rules.files a default of an empty list.
Also off note here, is that `when` statements are processed for e
I'm testing existing roles and playbooks against Ansible 2.2, and I've
noticed that several roles that I have written that take advantage of
"when: variable is defined" or "when: variable is undefined" in tasks no
longer work. This happens when a variable is used from a previous task,
but is e