.. _ansible.utils.get_path_lookup: ********************** ansible.utils.get_path ********************** **Retrieve the value in a variable using a path** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - Use a *path* to retrieve a nested value from a *var* - **get_path** is also available as a **filter plugin** for convenience - Using the parameters below- ``lookup('ansible.utils.get_path', var, path, wantlist``) Parameters ---------- .. raw:: html
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
path
string
/ required
|
The path in the var to retrieve the value of. The path needs to a be a valid jinja path.
|
||
var
raw
/ required
|
The variable from which the value should be extracted.
|
||
wantlist
boolean
|
|
If set to
True , the return value will always be a list. This can also be accomplished using query or q instead of lookup . https://docs.ansible.com/ansible/latest/plugins/lookup.html. |
Key | Returned | Description |
---|---|---|
_raw
-
|
One or more zero-based indices of the matching list items.
See
wantlist if a list is always required. |