Ansible stdout Formatting

Try this option. You’ll love it.

There’s a new YAML callback plugin introduced with Ansible 2.5 — meaning any machine running Ansible 2.5.0 or later can automatically start using this format without installing custom plugins.

To use it, edit your ansible.cfg file (either globally, in /etc/ansible/ansible.cfg, or locally in your playbook/project), and add the following lines under the [defaults] section:

# Use the YAML callback plugin.
stdout_callback = yaml
# Use the stdout_callback when running ad-hoc commands.
bin_ansible_callbacks = True

Now I can easily read through your output message

If you get the following error:

ERROR! Invalid callback for stdout specified: yaml

run

ansible-galaxy collection install community.general

Leave a Comment