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
[defaults] section in
ansible.cfg to enable debug in Ansible and set the level of verbosity:
||Set the default verbosity level|
||Enable the debug output|
Cool Tip: Ansible Playbook – Print Variable & List All Variables! Read more →