Ansible: Enable Debug and Increase Verbosity

During troubleshooting of Ansible issues it is useful to know how to enable debug mode and increase the level of verbosity.

To enable debug and increase verbosity in Ansible you can pass the corresponding environment variables on the command line or define these settings in Ansible configuration file.

Warning: The debug output can also include secret information despite no_log settings being enabled, which means debug mode should not be used in production.

Enable Debug and Increase Verbosity in Ansible

Run a playbook with enabled debug and with the maximum level of verbosity:

$ ANSIBLE_DEBUG=true ANSIBLE_VERBOSITY=4 ansible-playbook playbook.yml

– or –

$ ANSIBLE_DEBUG=true -vvvv ansible-playbook playbook.yml

You can also define these settings in ansible.cfg to enable debug in Ansible and set the level of verbosity:

Option Description
default_verbosity=[0|1|2|3|4] Set the default verbosity level
default_debug=[false|true] Enable the debug output

Cool Tip: Ansible Playbook – Print Variable & List All Variables! Read more →

Recommended Book
devops

This is a must-read for anyone who wants to understand, explain and implement DevOps culture, process and tools for high performance development and operations.

All DevOps practices in a single place - organisational, cultural and technical. Lots of exceptional case studies.

Increase profitability, elevate work culture, and exceed productivity goals through DevOps practices.