ansible / ansible.builtin / v2.16.0 / filter / to_yaml Convert variable to YAML string | "added in version" historical of ansible.builtin" Authors: core teamansible.builtin.to_yaml (v2.16.0) — filter
pip
Install with pip install ansible-core==2.16.0
Converts an Ansible variable into a YAML string representation.
This filter functions as a wrapper to the L(Python PyYAML library, https://pypi.org/project/PyYAML/)'s C(yaml.dump) function.
Ansible automatically converts YAML strings into variable structures so this plugin is used to forcibly retain a YAML string.
_input: description: A variable or expression that returns a data structure. required: true type: raw indent: description: Number of spaces to indent Python structures, mainly used for display to humans. type: integer sort_keys: default: true description: Affects sorting of dictionary keys. type: bool
_value: description: The YAML serialized string representing the variable structure inputted. type: string