# error message

**URL:** <https://forum.ansible.com/t/error-message/24571>\
**Category:** Ansible Project\
**Created:** [May 24, 2017, 9:08pm UTC](https://forum.ansible.com/t/error-message/24571 "2017-05-24T21:08:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daley\_Okuwa](https://avatars.discourse-cdn.com/v4/letter/d/a9a28c/32.png) [@Daley\_Okuwa](https://forum.ansible.com/u/Daley_Okuwa)\
**Post date:** [May 24, 2017, 9:08pm UTC](https://forum.ansible.com/t/error-message/24571/1 "2017-05-24T21:08:18Z")

</div>

hello when i try to run this command  
ansible all -i hosts -s --sudo -m ping

I get this error message

192.168.85.129 | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n”,  
“unreachable”: true

Please tell me what i am doing wrong  
Normally i can ssh into this hosts 192.168.85.129  
from the control server

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 28, 2017, 5:31pm UTC](https://forum.ansible.com/t/error-message/24571/2 "2017-05-28T17:31:43Z")

</div>

Are you using keys or password?  
If you are using password you are missing -k/--ask-pass option.

---

<div class="post-metadata">

**Author:** ![DOkuwa](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dokuwa/32/1471_2.png) [@DOkuwa](https://forum.ansible.com/u/DOkuwa)\
**Post date:** [May 30, 2017, 7:31am UTC](https://forum.ansible.com/t/error-message/24571/3 "2017-05-30T07:31:03Z")

</div>

thanks it worked  
But also how can i use ansible without prompting me for a password

and also another issue with ansible i am getting this error when running this adhoc command from the command line

kuwa@ubuntu:/etc/ansible$ ansible all -i hosts -u dokuwa1 --ask-pass -m yum -a “name=httpd state=present” --become-user=root --ask-become-pass  
SSH password:  
SUDO password[defaults to SSH password]:  
192.168.85.129 | FAILED! =\> {  
“changed”: false,  
“failed”: true,  
“msg”: “python2 bindings for rpm are needed for this module. python2 yum module is needed for this module”

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 30, 2017, 10:43am UTC](https://forum.ansible.com/t/error-message/24571/4 "2017-05-30T10:43:14Z")

</div>

ansible\_ssh\_pass, ssh key without password, ssh key with password and ssh-agent.  
What you can use depends on you requirement since some of them has security implication.
