I have the following task in a playbook:
- name: task xyz
copy:
src="{{ item }}"
dest="/tmp/{{ item }}"
with_items: "{{ y.z }}"
when: y.z is defined
y.z
is not defined, so I'm expecting the task to be skipped. Instead, I receive:
FAILED! => {"failed": true, "msg": "'dict object' has no attribute 'z'"
I have found: How to run a task when variable is undefined in ansible? but it seems I implemented just that. What am I doing wrong here?