You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gives you a lot of freedom to get the output you want.
196
+
197
+
In some cases, it is not sufficient though.
198
+
For example, if you want to extract YAML output, and present it in a way that [matches your yamllint configuration](https://ansible.readthedocs.io/projects/antsibull-nox/config-file/#yamllint-part-of-the-yamllint-session).
199
+
The default callback's YAML output suffers from [PyYAML's list indentation issue](https://github.com/yaml/pyyaml/issues/234),
200
+
which causes problems with many yamllint configurations.
201
+
Also, the [ansible.builtin.default callback's YAML output](https://docs.ansible.com/ansible/devel/collections/ansible/builtin/default_callback.html#parameter-result_format) is indented by 4 spaces,
202
+
while most YAML is expected to be indented by 2 spaces.
203
+
204
+
If you use the above settings (`skip_first_lines` / `skip_last_lines`) to extract only the YAML content of one task of the playbook's output,
205
+
you can for example use [Pretty YAML (pyaml)](https://pypi.org/project/pyaml/) to reformat it.
206
+
For that, you can use the `postprocessors` list to specify a post-processor command:
207
+
```yaml
208
+
postprocessors:
209
+
- command:
210
+
- python
211
+
- "-m"
212
+
- pyaml
213
+
```
214
+
This tells `antsibull-docs ansible-output` to feed the extracted output
215
+
(with `skip_first_lines`, `skip_last_lines`, and `prepend_lines` already processed)
216
+
through standard input into the `python -m pyaml` process,
0 commit comments