# SSH error with ansible

**URL:** <https://forum.ansible.com/t/ssh-error-with-ansible/19492>\
**Category:** Ansible Developer\
**Created:** [October 12, 2015, 6:35pm UTC](https://forum.ansible.com/t/ssh-error-with-ansible/19492 "2015-10-12T18:35:48Z")\
**Posts on this page:** 5\
**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:35pm UTC](https://forum.ansible.com/t/ssh-error-with-ansible/19492/1 "2015-10-12T18:35:48Z")

</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](http://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](http://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:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [October 12, 2015, 8:08pm UTC](https://forum.ansible.com/t/ssh-error-with-ansible/19492/2 "2015-10-12T20:08:41Z")

</div>

Check the permissions of all the paths up to the .ssh directory and the id\_rsa.pub or id\_dsa.pub keys.

---

<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, 8:45pm UTC](https://forum.ansible.com/t/ssh-error-with-ansible/19492/3 "2015-10-12T20:45:53Z")

</div>

I checked it’s not permission issues

---

<div class="post-metadata">

**Author:** ![Steve\_Kieu](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Steve\_Kieu](https://forum.ansible.com/u/Steve_Kieu)\
**Post date:** [October 16, 2015, 12:24am UTC](https://forum.ansible.com/t/ssh-error-with-ansible/19492/4 "2015-10-16T00:24:24Z")

</div>

long time ago I got some problems with default ssh and try (in ansible.cfg)

ansible\_connection: paramiko

that works for me

---

<div class="post-metadata">

**Author:** ![Bhotu](https://avatars.discourse-cdn.com/v4/letter/b/439d5e/32.png) [@Bhotu](https://forum.ansible.com/u/Bhotu)\
**Post date:** [December 4, 2015, 6:58pm UTC](https://forum.ansible.com/t/ssh-error-with-ansible/19492/5 "2015-12-04T18:58:31Z")

</div>

What is your inventory ?
