when clause in combination with list of hashes.

Hi,

Consider the following list of hashes being defined:

my_list: [ { src: “a”, dest: “b”, mode: 755 }
, { src: “d”, dest: “e”, mode: 640 }
]

and this task:

  • name: example
    file:
    path: “{{ item }}”
    state: absent
    with_items: some_other_list
    when: item not in my_list # (… how to match against ‘src’ ?? )

The ‘when:’ clause in this specific case needs to look at ‘src’ from ‘my_list’, is there a way to define this?

Thanks,
Nico.

when: item.src not in my_list