Clean error output in ansible-playbook

YAML output is available as of Ansible 2.5.

Add these lines in the [defaults] section of your ansible.cfg:

stdout_callback = yaml
stderr_callback = yaml

If you're used to the default output, this will change your life!

Of the other output options, minimal and debug also provide nice JSON output.


Add stdout_callback=debug and stderr_callback=debug in the defaults section of your ansible.cfg file.

[defaults]
(...)
stdout_callback=debug
stderr_callback=debug

This is supported by ansible > 2.0


Ansible Callbacks Callbacks are one of the more interesting plugin types. Adding additional callback plugins to Ansible allows for adding new behaviors when responding to events.

Human-Readable Ansible Playbook Log Output Using Callback Plugin.