vbotka
(Vladimir Botka)
February 17, 2025, 5:57am
1
Already announced community.general.yaml has been deprecated . This callback indentes the output by 2. For example, given the below dictionary
test:
a: [foo, bar]
b: {x: foo, y: bar}
The debug
- debug:
var: test
shows
test:
a:
- foo
- bar
b:
x: foo
y: bar
When I switch to the recommended
callback_result_format = yaml
the same debug shows
test:
a:
- foo
- bar
b:
x: foo
y: bar
How do I configure the indentation of this output to 2?
chris
(Chris Croome)
February 17, 2025, 8:56am
2
Is this a “feature” of PyYAML and is this pull request from @bcoca the answer?
vbotka
(Vladimir Botka)
February 17, 2025, 9:44am
3
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.)
1 Like
shertel
February 17, 2025, 2:00pm
4
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 .
1 Like
bcoca
(Brian Coca)
February 17, 2025, 5:22pm
5
no, that is for an indent issue with lists, - thing
vs - thing
.
1 Like