Ansible - Verbose Flags (-v -vv -vvv)
by
Jeremy Canfield |
Updated: February 22 2021
| Ansible articles
Let's say you are using the file module to create the /tmp/foo directory on your managed nodes (e.g. the target systems).
---
- hosts: all
tasks:
- name: mkdir /tmp/foo
file:
path: /tmp/foo
state: directory
...
If something is not working as expected, the verbose flags can be used.
ansible-playbook foo.yml -v
Following is what would be returned with the -v flag.
TASK [mkdir /tmp/foo]
changed: [server1.example.com] => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": true, "gid": 0, "group": "root", "mode": "0755", "owner": "root", "path": "/tmp/foo", "secontext": "unconfined_u:object_r:user_tmp_t:s0", "size": 6, "state": "directory", "uid": 0}
Following is what would be returned with the -vv flag.
TASK [mkdir /tmp/foo]
task path: /usr/local/ansible/playbooks/new_server_setup.yml:34
changed: [server1.example.com] => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": true, "gid": 0, "group": "root", "mode": "0755", "owner": "root", "path": "/tmp/foo", "secontext": "unconfined_u:object_r:user_tmp_t:s0", "size": 6, "state": "directory", "uid": 0}
META: ran handlers
META: ran handlers
The -vvv and -vvvv flags provides too much output to be represented here, and is used for more extreme debugging situations.
If the verbose flags fail to produce the details needed, you can set the ANSIBLE_DEBUG environmental varabile to true.
Did you find this article helpful?
If so, consider buying me a coffee over at