I am using a dynamic inventory. The build inventory returns hosts vars with the following
inventory_hostname= jenkins-0.build.vnet
ansible_host=y.y.y.y (There are private ips)
I also have
x.x.x.x = The public ip of the jump box
I have the following in my ssh.cfg which is referenced in my ansible.cfg
Host build-bastion
HostName x.x.x.x
ForwardAgent yes
Host *.build.vnet
ProxyCommand ssh build-bastion -W %h:%p
This does not work and I get an “unreachable” error.
If remove the dynamic inventory entirely and do the following in my static inventory
[build-jenkins]
jenkins-0.build.vnet ansible_host=y.y.y.y
It still does not work
However, the below does work.
[build-jenkins]
jenkins-0.build.vnet ansible_host=y.y.y.y ansible_ssh_common_args=' -o ProxyCommand="ssh -W %h:%p x.x.x.x"'
In fact, if I run the hardcoded static version, then remove it and use the dynamic version, it works. I assume because of connection caching.
I cannot set the args global, because we have different boxes for different customers and environments.
-b