# How to debug ansible issues?

**URL:** <https://forum.ansible.com/t/how-to-debug-ansible-issues/13170>\
**Category:** Ansible Project\
**Created:** [July 21, 2013, 5:29am UTC](https://forum.ansible.com/t/how-to-debug-ansible-issues/13170 "2013-07-21T05:29:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@John\_Anderson](https://forum.ansible.com/u/John_Anderson)\
**Post date:** [July 21, 2013, 5:29am UTC](https://forum.ansible.com/t/how-to-debug-ansible-issues/13170/1 "2013-07-21T05:29:36Z")

</div>

I have a task like this:

- name: cloning source from git  
command: git clone -b {{item.version}} git@url/{{item.name}}.git /opt/src/{{item.name}}  
with\_items:
- { name: ‘pkg1’, version: ‘allow\_overriding\_pin’ }
- { name: ‘pkg2’, version: ‘allow\_overriding\_pin’ }
- { name: ‘pkg3’, version: ‘master’ }
- { name: ‘pkg4’, version: ‘master’ }
- { name: ‘pkg5’, version: ‘master’ }
- { name: ‘pkg6’, version: ‘master’ }  
notify:
- Restart nginx

And its currently locking up when executing, I ran playbook with -vvv to get a little better output and came up with:

TASK: [cloning source from git] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<192.168.21.254\> ESTABLISH CONNECTION FOR USER: vagrant  
\<192.168.21.254\> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=vagrant’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.21.254’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-1374382621.36-34466305103908 && chmod a+rx $HOME/.ansible/tmp/ansible-1374382621.36-34466305103908 && echo $HOME/.ansible/tmp/ansible-1374382621.36-34466305103908’”]  
\<192.168.21.254\> REMOTE\_MODULE command git clone -b allow\_overriding\_pin git@/.git /opt/src/  
\<192.168.21.254\> PUT /tmp/tmpS5fOOr TO /home/vagrant/.ansible/tmp/ansible-1374382621.36-34466305103908/command  
\<192.168.21.254\> EXEC [‘ssh’, ‘-tt’, ‘-q’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/tmp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=22’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=vagrant’, ‘-o’, ‘ConnectTimeout=10’, ‘192.168.21.254’, “/bin/sh -c ‘/usr/bin/python /home/vagrant/.ansible/tmp/ansible-1374382621.36-34466305103908/command; rm -rf /home/vagrant/.ansible/tmp/ansible-1374382621.36-34466305103908/ \>/dev/null 2\>&1’”]

Which isn’t enough to figure out exactly why its locking up. I think maybe its because the SSH key requires a password but I’m trying to figure out how I could get more detailed output to findout exactly what the problem is. Is there a flag I can pass to ansible that will output the last executed line so that I could set a PDB and inspect things from there?

Outside of that my questions are:

1. If it is the SSH key password, is there a way to get ansible to prompt me for the pw?
2. Is that the best way to structure a task that is cloning from git?
3. Can I factor out my with items into a variable inside a role? I re-use that same list of services in 3 tasks but since its specific to the role, I don’t want to create a group\_var/host\_var.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [July 21, 2013, 12:29pm UTC](https://forum.ansible.com/t/how-to-debug-ansible-issues/13170/2 "2013-07-21T12:29:07Z")

</div>

You should be using the git module first, because git is going interactive.

I’m not sure I understand your role question.
