# Ping module - SSH connection fails on my Fedora 23 box

**URL:** <https://forum.ansible.com/t/ping-module-ssh-connection-fails-on-my-fedora-23-box/21885>\
**Category:** Ansible Project\
**Tags:** fedora\
**Created:** [June 29, 2016, 6:48am UTC](https://forum.ansible.com/t/ping-module-ssh-connection-fails-on-my-fedora-23-box/21885 "2016-06-29T06:48:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hornbachner\_Simon](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@Hornbachner\_Simon](https://forum.ansible.com/u/Hornbachner_Simon)\
**Post date:** [June 29, 2016, 6:48am UTC](https://forum.ansible.com/t/ping-module-ssh-connection-fails-on-my-fedora-23-box/21885/1 "2016-06-29T06:48:47Z")

</div>

Ahoy hoy Ansiblers,  
I can't get Ansible to work from my Fedora 23 box. I don't have any  
firewall running, but can't even connect to localhost. Doing ssh user@m  
yhost manually works perfectly. And most interestingly, if I check the  
SSH log, sshd says that it "accepted password for user" when I try the  
ansible ping module. But ansible keeps insisting that the SSH  
connection failed. I'm really out of ideas here. Can anyone help me?

Here's some (what I think as revelant) information.

[USER@MYHOST try-ansible]$ cat ansible-hosts  
[localhost]  
127.0.0.1

[USER@MYHOST try-ansible]$ cat /etc/redhat-release  
Fedora release 23 (Twenty Three)

[USER@MYHOST try-ansible]$ ansible -i ansible-hosts localhost -m ping  
-vvvv --ask-pass  
Using /etc/ansible/ansible.cfg as config file  
SSH password:  
Loaded callback minimal of type stdout, v2.0  
\<127.0.0.1\> ESTABLISH SSH CONNECTION FOR USER: None  
\<127.0.0.1\> SSH: EXEC sshpass -d12 ssh -C -vvv -o ControlMaster=auto -o  
ControlPersist=60s -o StrictHostKeyChecking=no -o ConnectTimeout=10 -o  
ControlPath=$HOME/.ansible/cp/ansible-ssh-%C 127.0.0.1 '/bin/sh -c  
'"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-  
1467180026.69-79439094193283 `" && echo ansible-tmp-1467180026.69-  
79439094193283="` echo $HOME/.ansible/tmp/ansible-tmp-1467180026.69-  
79439094193283 `" ) && sleep 0'"'"''  
127.0.0.1 | UNREACHABLE! =\> {  
"changed": false,  
"msg": "Failed to connect to the host via ssh.",  
"unreachable": true  
}

[USER@MYHOST try-ansible]$ sudo journalctl -xn -u sshd  
Jun 29 08:38:51 MYHOST sshd[23839]: pam\_succeed\_if(sshd:auth): no  
condition detected; module succeeded  
Jun 29 08:38:51 MYHOST sshd[23839]: pam\_sss(sshd:auth): authentication  
success; logname= uid=0 euid=0 tty=ssh ruser= rhost=127.0.0.1  
user=31100822  
Jun 29 08:38:51 MYHOST sshd[23839]: pam\_succeed\_if(sshd:account): no  
condition detected; module succeeded  
Jun 29 08:38:51 MYHOST sshd[23839]: Accepted password for USER from  
127.0.0.1 port 57864 ssh2

Thanks in advance,  
Simon

---

<div class="post-metadata">

**Author:** ![sdarwin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sdarwin/32/2450_2.png) [@sdarwin](https://forum.ansible.com/u/sdarwin)\
**Post date:** [June 30, 2016, 1:11pm UTC](https://forum.ansible.com/t/ping-module-ssh-connection-fails-on-my-fedora-23-box/21885/2 "2016-06-30T13:11:00Z")

</div>

1. did you try the --ask-pass command line option?
2. ssh keys are preferable to passwords, configure those first instead. [http://docs.ansible.com/ansible/intro\_adhoc.html](http://docs.ansible.com/ansible/intro_adhoc.html)

---

<div class="post-metadata">

**Author:** ![Hornbachner\_Simon](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@Hornbachner\_Simon](https://forum.ansible.com/u/Hornbachner_Simon)\
**Post date:** [July 4, 2016, 9:12am UTC](https://forum.ansible.com/t/ping-module-ssh-connection-fails-on-my-fedora-23-box/21885/3 "2016-07-04T09:12:31Z")

</div>

Ahoy Sam,  
thanks for the answer.

> 1. did you try the --ask-pass command line option?

Sorry, the command wasn't wrapped ideally, so you probably missed it: I  
am using --ask-pass. See the full command again below.

ansible -i ansible-hosts localhost -m ping -vvvv --ask-pass

> 2. ssh keys are preferable to passwords, configure those first  
> instead. [http://docs.ansible.com/ansible/intro\_adhoc.html](http://docs.ansible.com/ansible/intro_adhoc.html)

I experience the same behavior when using keys. If you have any idea as  
to what might cause this, I'd be happy to supply more information.

Any help would be highly appreciated.

All the best, Simon

---

<div class="post-metadata">

**Author:** ![sdarwin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sdarwin/32/2450_2.png) [@sdarwin](https://forum.ansible.com/u/sdarwin)\
**Post date:** [July 4, 2016, 1:55pm UTC](https://forum.ansible.com/t/ping-module-ssh-connection-fails-on-my-fedora-23-box/21885/4 "2016-07-04T13:55:00Z")

</div>

1. to get ssh keys to work, how about removing the --ask-pass option. Then review the logs on both client and server, it should not say “Accepted password for USER”, since it’s with keys rather than passwords.

2. going back to passwords again: have you already run “yum install sshpass”? that is required.

---

<div class="post-metadata">

**Author:** ![Hornbachner\_Simon](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@Hornbachner\_Simon](https://forum.ansible.com/u/Hornbachner_Simon)\
**Post date:** [July 5, 2016, 8:55am UTC](https://forum.ansible.com/t/ping-module-ssh-connection-fails-on-my-fedora-23-box/21885/5 "2016-07-05T08:55:55Z")

</div>

Ahoy hoy,

I've pinpointed the source of my problems - for some reason, the  
default configuration doesn't work for me. If installed via dnf,  
/etc/ansible/ansible.cfg contains the line

control\_path = %(directory)s/ansible-ssh-%%C

If I comment this out, ansible presumably falls back to the default  
(%(directory)s/ansible-ssh-%%h-%%p-%%r), which works.

I'm probably gonna open a github issue on this. I assume it has  
something to do with the fact, that my machine uses Active Directory  
authentication.

Can someone point me to the documentation of what %%C does? I've  
searched, but couldn't find it.

All the best, simon
