I have the list:
val_list:
- val: "D"
- val: "A"
- val: "B"
- val: "C"
I would like to set variable true if list contain val: B without creating register variable task, for example:
- set_fact:
containB: false
- set_fact:
containB: true
when: item.val=='B'
with_items
- "{{ val_list }}"
I would like to convert to something like that:
- set_fact:
containB: true if item.val=='B' | default(false)
#or containB: true if any val in val_list is 'B'
with_items
- "{{ val_list }}"