from_yaml_all¶
Collection Note
This module is part of the ansible.builtin collection. To install the collection, use:
Added in versionhistorical.
Synopsis¶
- Converts a YAML documents in a string representation into an equivalent structured Ansible variable.
- Ansible internally auto-converts YAML strings into variable structures in most contexts, but by default does not handle 'multi document' YAML files or strings.
- If multiple YAML documents are not supplied, this is the equivalence of using C(from_yaml).
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| _input string required |
A YAML string. |
Notes¶
Note
- This filter functions as a wrapper to the Python C(yaml.safe_load_all) function, part of the L(pyyaml Python library, https://pypi.org/project/PyYAML/).
- Possible conflicts in variable names from the multiple documents are resolved directly by the pyyaml library.
Examples¶
# variable from string variable containing YAML documents
{{ multidoc_yaml_string | from_yaml_all }}
# variable from multidocument YAML string
{{ '---\n{"a": true, "b": 54, "c": [1,2,3]}\n...\n---{"x": 1}\n...\n' | from_yaml_all }}
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| _value | raw | The variable resulting from deserializing the YAML documents. |