Ansible - Verbose Flags (-v -vv -vvv)

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.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter ff3a7 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |