# SSH trouble wit Ansible

**URL:** <https://forum.ansible.com/t/ssh-trouble-wit-ansible/19491>\
**Category:** Ansible Project\
**Created:** [October 12, 2015, 6:14pm UTC](https://forum.ansible.com/t/ssh-trouble-wit-ansible/19491 "2015-10-12T18:14:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GBANE\_FETIGUE](https://avatars.discourse-cdn.com/v4/letter/g/6bbea6/32.png) [@GBANE\_FETIGUE](https://forum.ansible.com/u/GBANE_FETIGUE)\
**Post date:** [October 12, 2015, 6:14pm UTC](https://forum.ansible.com/t/ssh-trouble-wit-ansible/19491/1 "2015-10-12T18:14:04Z")

</div>

Hey Guys I am trying to run that playbook but for some reason it’s not running

root@ip-172-16-20-180:/var/lib/jenkins/jobs/build-cs-utils/workspace/playbooks# ansible-playbook -i inventory/prod deploy\_system\_status.yml  
Enter the version you want to deploy:

PLAY [Deploy to status servers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [prodstatus0] =\> SSH Error: Permission denied (publickey).  
while connecting to 172.16.21.129:22  
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

TASK: [nodejs\_app | Put upstart script in place] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
FATAL: no hosts matched or all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/root/deploy\_system\_status.retry

prodstatus0 : ok=0 changed=0 unreachable=1 failed=0

Here is also the command with -vvvv

root@ip-172-16-20-180:/var/lib/jenkins/jobs/build-cs-utils/workspace/playbooks# ansible-playbook -i inventory/prod deploy\_system\_status.yml -vvvv  
Enter the version you want to deploy:

PLAY [Deploy to status servers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

GATHERING FACTS \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<172.16.21.129\> ESTABLISH CONNECTION FOR USER: ansible  
\<172.16.21.129\> REMOTE\_MODULE setup  
\<172.16.21.129\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o IdentityFile=“/root/credentials/ansible\_id\_rsa” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 172.16.21.129 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1444673619.82-165283189134845 && echo $HOME/.ansible/tmp/ansible-tmp-1444673619.82-165283189134845’  
fatal: [prodstatus0] =\> SSH Error: Permission denied (publickey).  
while connecting to 172.16.21.129:22  
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

TASK: [nodejs\_app | Put upstart script in place] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
FATAL: no hosts matched or all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/root/deploy\_system\_status.retry

prodstatus0 : ok=0 changed=0 unreachable=1 failed=0

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [October 24, 2015, 12:04am UTC](https://forum.ansible.com/t/ssh-trouble-wit-ansible/19491/2 "2015-10-24T00:04:45Z")

</div>

it seems the ansible user cannot login to that server with that key,  
you can try:

ssh ansible@172.16.21.129 -i "/root/credentials/ansible\_id\_rsa -vvvv

to ensure its a ssh connection issue.
