# The callback\_result\_format yaml indentation

**URL:** <https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300>\
**Category:** Get Help\
**Tags:** yaml, callback\
**Created:** [February 17, 2025, 5:57am UTC](https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300 "2025-02-17T05:57:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [February 17, 2025, 5:57am UTC](https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300/1 "2025-02-17T05:57:51Z")

</div>

Already announced [community.general.yaml has been deprecated](https://forum.ansible.com/t/ansible-yaml-output-community-general-yaml-has-been-deprecated/). This callback indentes the output by 2. For example, given the below dictionary

```yaml
    test:
      a: [foo, bar]
      b: {x: foo, y: bar}

```

The debug

```yaml
    - debug:
        var: test

```

shows

```yaml
  test:
    a:
    - foo
    - bar
    b:
      x: foo
      y: bar

```

When I switch to the recommended

```ini
callback_result_format = yaml

```

the same debug shows

```yaml
    test:
        a:
        - foo
        - bar
        b:
            x: foo
            y: bar

```

How do I configure the indentation of this output to 2?

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 17, 2025, 8:56am UTC](https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300/2 "2025-02-17T08:56:00Z")

</div>

Is this a [“feature”](https://github.com/yaml/pyyaml/issues/234) of [PyYAML](https://pypi.org/project/PyYAML/) and is [this pull request](https://github.com/yaml/pyyaml/pull/842/commits) from @bcoca the answer?

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [February 17, 2025, 9:44am UTC](https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300/3 "2025-02-17T09:44:19Z")

</div>

Thank you for the links. The list indentation is an important part of the story. But, no, this doesn’t answer the question. The question is: **“How do I configure the indentation of this output to 2?”**. (Or any other natural number.)

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [February 17, 2025, 2:00pm UTC](https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300/4 "2025-02-17T14:00:20Z")

</div>

There isn’t an option to figure it currently. The default callback uses the base class to dump results (without specifying an indentation), which causes the indentation to end up as 4 [ansible/lib/ansible/plugins/callback/\_\_init\_\_.py at stable-2.18 · ansible/ansible · GitHub](https://github.com/ansible/ansible/blob/stable-2.18/lib/ansible/plugins/callback/ __init__.py#L227).

---

<div class="post-metadata">

**Author:** ![bcoca](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/bcoca/32/9269_2.png) [@bcoca](https://forum.ansible.com/u/bcoca)\
**Post date:** [February 17, 2025, 5:22pm UTC](https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300/5 "2025-02-17T17:22:28Z")

</div>

> [@shertel](#):
>
> gure it currently. The default callback uses the base class to dump results (without specifying an indentation), which causes the indentation to end up a

no, that is for an indent issue with lists, `- thing` vs ` - thing`.

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [February 26, 2025, 4:45pm UTC](https://forum.ansible.com/t/the-callback-result-format-yaml-indentation/40300/6 "2025-02-26T16:45:27Z")

</div>

For the record: There is no solution. The recommended _callback\_result\_format_ yaml indentation by 4 spaces is hardcoded. The reasonable 2 spaces indentation by _community.general.yaml_ will be deprecated in 13.0
