# Failed to connect to the host via ssh: ssh: connect to host

**URL:** <https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-ssh-connect-to-host/31528>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 23, 2019, 2:30pm UTC](https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-ssh-connect-to-host/31528 "2019-10-23T14:30:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frazer\_Grant](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@Frazer\_Grant](https://forum.ansible.com/u/Frazer_Grant)\
**Post date:** [October 23, 2019, 2:30pm UTC](https://forum.ansible.com/t/failed-to-connect-to-the-host-via-ssh-ssh-connect-to-host/31528/1 "2019-10-23T14:30:35Z")

</div>

Hi,

I feel a little bit uncomfortable posting this, as it seems it should be a simple fix, but I cannot seem to find an answer.

Ive just installed Ansible 2.8.5 into a Vagrant VM on my laptop and from that I can **gcloud compute ssh** into my VMs, centos 7 and RedHat Enterprise 7, in Google Cloud fine and I can use the Linux **ssh** command into both servers. So the certificates are fine and ssh is working.

However when I try **ansible _._._._ -m ping** , I’ve \* out the actual IP, I get the following:

_._._._ | UNREACHABLE! =\> {  
“changed”: false,  
“msg”: “Failed to connect to the host via ssh: OpenSSH\_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh\_config\r\ndebug1: /etc/ssh/ssh\_config line 19: Applying options for _\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/home/vagrant/.ansible/cp/6c6506f41a" does not exist\r\ndebug2: resolving "_._._._" port 22\r\ndebug2: ssh\_connect\_direct: needpriv 0\r\ndebug1: Connecting to .._.\* [_._._._] port 22.\r\ndebug2: fd 3 setting O\_NONBLOCK\r\ndebug1: connect to address _._._._ port 22: Connection timed out\r\nssh: connect to host _._._._ port 22: Connection timed out”,  
“unreachable”: true  
}

however when I run

ansible _._._._ -m ping -c paramiko

it works:

[WARNING]: Platform linux on host _._._._ is using the discovered Python interpreter at  
/usr/bin/python, but future installation of another Python interpreter could change this. See  
[https://docs.ansible.com/ansible/2.8/reference\_appendices/interpreter\_discovery.html](https://docs.ansible.com/ansible/2.8/reference_appendices/interpreter_discovery.html) for more  
information.

_._._._ | SUCCESS =\> {  
“ansible\_facts”: {  
“discovered\_interpreter\_python”: “/usr/bin/python”  
},  
“changed”: false,  
“ping”: “pong”  
}

Any ideas as to why is this happening?

Thank you for your help.

Note:

When I uploaded the id\_rsa key to the servers I had to amend the file and change the user name for it to work. Not sure if this is a factor to what is happening here.
