New in version 1.5.
Parameter |
Choices/Defaults |
Configuration |
Comments |
---|---|---|---|
_terms
required |
|
|
A list of dictionaries
|
tasks:
- name: show dictionary
debug: msg="{{item.key}}: {{item.value}}"
with_dict: {a: 1, b: 2, c: 3}a
# with predefined vars
vars:
users:
alice:
name: Alice Appleworth
telephone: 123-456-7890
bob:
name: Bob Bananarama
telephone: 987-654-3210
tasks:
- name: Print phone records
debug:
msg: "User {{ item.key }} is {{ item.value.name }} ({{ item.value.telephone }})"
loop: "{{ lookup('dict', users) }}"
Common return values are documented here, the following are the fields unique to this lookup:
Key |
Returned |
Description |
---|---|---|
_list
list
|
list of composed dictonaries with key and value
|
Hint
If you notice any issues in this documentation you can edit this document to improve it.