# Ansible Failed to Run because of SSH

**URL:** <https://forum.ansible.com/t/ansible-failed-to-run-because-of-ssh/19496>\
**Category:** Ansible Project\
**Created:** [October 13, 2015, 2:33pm UTC](https://forum.ansible.com/t/ansible-failed-to-run-because-of-ssh/19496 "2015-10-13T14:33:45Z")\
**Posts on this page:** 4\
**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 13, 2015, 2:33pm UTC](https://forum.ansible.com/t/ansible-failed-to-run-because-of-ssh/19496/1 "2015-10-13T14:33:45Z")

</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:** ![Andrey\_Fesenko](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Andrey\_Fesenko](https://forum.ansible.com/u/Andrey_Fesenko)\
**Post date:** [October 13, 2015, 4:49pm UTC](https://forum.ansible.com/t/ansible-failed-to-run-because-of-ssh/19496/2 "2015-10-13T16:49:41Z")

</div>

See [http://docs.ansible.com/ansible/intro\_getting\_started.html](http://docs.ansible.com/ansible/intro_getting_started.html)  
"Ansible by default assumes you are using SSH keys. SSH keys are encouraged but password authentication can also be used where needed by supplying the option `--ask-pass"`

---

<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 13, 2015, 7:06pm UTC](https://forum.ansible.com/t/ansible-failed-to-run-because-of-ssh/19496/3 "2015-10-13T19:06:04Z")

</div>

Still not working

---

<div class="post-metadata">

**Author:** ![Mauricio\_Tavares](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Mauricio\_Tavares](https://forum.ansible.com/u/Mauricio_Tavares)\
**Post date:** [October 13, 2015, 7:10pm UTC](https://forum.ansible.com/t/ansible-failed-to-run-because-of-ssh/19496/4 "2015-10-13T19:10:06Z")

</div>

> Still not working

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You might want to elaborate.
