# ansible.builtin.to_yaml
Converts an Ansible variable into a [YAML](../../../files/YAML.md) string representation.

## Parameters
| Parameter  | Type           | Description                                                               |
| ---------- | -------------- | ------------------------------------------------------------------------- |
| **Input**  | any / required | A variable or expression that returns a data structure.                   |
| **indent** | integer        | Number of spaces to indent structures, mainly used for display to humans. |

## Examples
```yml
# dump variable in a template to create a YAML document
{{ github_workflow | to_yaml }}

# same as above but 'prettier' (equivalent to to_nice_yaml filter)
{{ docker_config | to_yaml(indent=4) }}
```