diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /lib/ansible/plugins/filter/from_yaml_all.yml | |
parent | Initial commit. (diff) | |
download | ansible-core-upstream.tar.xz ansible-core-upstream.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | lib/ansible/plugins/filter/from_yaml_all.yml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/ansible/plugins/filter/from_yaml_all.yml b/lib/ansible/plugins/filter/from_yaml_all.yml new file mode 100644 index 0000000..b179f1c --- /dev/null +++ b/lib/ansible/plugins/filter/from_yaml_all.yml @@ -0,0 +1,28 @@ +DOCUMENTATION: + name: from_yaml_all + version_added: 'historical' + short_description: Convert a series of YAML documents into a variable structure + description: + - 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 equivalend of using C(from_yaml). + notes: + - 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 mulitple documents are resolved directly by the pyyaml library. + options: + _input: + description: A YAML string. + type: string + required: true + +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: + _value: + description: The variable resulting from deserializing the YAML documents. + type: raw |