Add example of using loop: with when: statements (#42776)

pull/42967/merge
FragmentedPacket 6 years ago committed by Jordan Borean
parent a9b1af8bdd
commit d2409fb165

@ -38,6 +38,12 @@ tasks:
debug:
msg: "{{item.key}}: {{item.value}}"
with_dict: {a: 1, b: 2, c: 3}
# Items from loop can be used in when: statements
- name: set_fact when alice in key
set_fact:
alice_exists: true
loop: "{{ lookup('dict', users) }}"
when: "'alice' in item.key"
"""
RETURN = """

Loading…
Cancel
Save