blob: 4677a86135a95890ddd5ae130fa02c437822d9d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
DOCUMENTATION:
name: to_yaml
author: core team
version_added: 'historical'
short_description: Convert variable to YAML string
description:
- 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 internally auto-converts YAML strings into variable structures so this plugin is used to force it into a YAML string.
positional: _input
options:
_input:
description: A variable or expression that returns a data structure.
type: raw
required: true
indent:
description: Number of spaces to indent Python structures, mainly used for display to humans.
type: integer
sort_keys:
description: Affects sorting of dictionary keys.
default: True
type: bool
#allow_unicode:
# description:
# type: bool
# default: true
#default_style=None, canonical=None, width=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None
notes:
- More options may be available, see L(PyYAML documentation, https://pyyaml.org/wiki/PyYAMLDocumentation) for details.
- 'These parameters to C(yaml.dump) will be ignored, as they are overriden internally: I(default_flow_style)'
EXAMPLES: |
# dump variable in a template to create a YAML document
{{ github_workflow | to_nice_yaml }}
RETURN:
_value:
description: The YAML serialized string representing the variable structure inputted.
type: string
|