Ansible through Bastion server SSH Error
<p>Following this guide (and others) <a href="http://blog.scottlowe.org/2015/12/24/running-ansible-through-ssh-bastion-host/" rel="nofollow" title="running-ansible-through-ssh-bastion-host">running-ansible-through-ssh-bastion-host</a>.
I have my ssh.cfg file set up to allow connecting to a host behind multiple bastions.</p>

<p>proxy -> util -> monitor -> more</p>

<p>I can connect to the util server:
<code>
[self@home]$ ssh -F ssh.cfg util
...
[self@util]$
</code></p>

<p>and the monitoring server:
<code>
[self@home]$ ssh -F ssh.cfg monitor
...
[self@monitor]$
</code></p>

<p>ssh.conf:</p>

<pre><code>Host *
    ServerAliveInterval 60
    ControlMaster   auto
    ControlPath     ~/.ssh/mux-%r@%h:%p
    ControlPersist  15m

Host proxy
    HostName proxy01.com
    ForwardAgent yes

Host util
    HostName util01.priv
    ProxyCommand ssh -W %h:%p proxy

Host monitor
    HostName mon01.priv
    ProxyCommand ssh -W %h:%p util
</code></pre>

<p>ansible inventory file:</p>

<pre><code>[bastion]
    proxy

[utility]
    util
    monitor
</code></pre>

<p>ansible.cfg:</p>

<pre><code>[ssh_connection]
ssh_args = -F ./ssh.cfg -o ControlMaster=auto -o ControlPersist=15m
control_path = ~/.ssh/ansible-%%r@%%h:%%p
</code></pre>

<p>When I execute any ansible commands, they appear to hit the proxy host without any problem, but fail to connect to the util host and the monitor host.</p>

<pre><code>&gt; ansible all -a "/bin/echo hello"
util | UNREACHABLE! =&gt; {
    "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 &gt;&gt;
hello

monitor | UNREACHABLE! =&gt; {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh.", 
    "unreachable": true
}
</code></pre>

<p>ADDITIONAL:
after some more hacking around, I have key'd the monitor host, and found that ansible can connect to the proxy,and the monitor, but fails on the util host... which is extremely odd because it has to pass through the util host to hit the monitor.</p>

<pre><code>util | UNREACHABLE! =&gt; {
    "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 &gt;&gt;
hello
monitor | SUCCESS | rc=0 &gt;&gt;
hello
</code></pre>