Error saying " "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "

0 votes

When I execute any ansible command, they appear to hit the proxy host without any issues but it fails to connect to util and monitor host.

> ansible all -a "/bin/echo hello"
util | UNREACHABLE! => {
    "changed": false, 
    "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", 
    "unreachable": true
}
proxy | SUCCESS | rc=0 >>
hello

monitor | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh.", 
    "unreachable": true
}
Feb 7 in Ansible by Alia
641 views

1 answer to this question.

0 votes

Hey @Alia, I faced a similar issue. Change your config file to something like this:

Host *
    ServerAliveInterval 60
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    ForwardAgent yes

####### Access to the Private Subnet Server through Proxy/bastion ########

Host proxy-server
    HostName x.x.x.x
    ForwardAgent yes

Host private-server
  HostName y.y.y.y
  ProxyCommand ssh -q proxy-server nc -q0 %h %p

Hope it help :)

answered Feb 7 by Pragya

Related Questions In Ansible

0 votes
1 answer
0 votes
3 answers
+13 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
181 views
0 votes
1 answer
0 votes
1 answer

Remote host throwing error saying "Permission Denied" - Ansible

Hey @Patrick, Change the path of Ansible's remote_tmp ...READ MORE

answered Jan 16 in Ansible by Cerci
223 views