I’m using Ansible 1.9.3 on Ubuntu 14.04 and trying to develop a custom dynamic inventory.
My dynamic inventory returns some of the ansible_ssh_* hostvars to help ansible connect, below is a redacted output of the dynamic inventory script for a particular host.
~/Projects/ansible-test $ ../ansible-dyn-inv/ter-inv.py --host consul-0 --pretty { ... "ansible_ssh_private_key_file": "$KEYDIR/consul.pem", "ansible_ssh_host": "10.114.76.209", "ansible_ssh_args": "-o ControlPersist=15m -o ProxyCommand=\"ssh -W %h:%p -I $KEYDIR/nat-admin.pem ubuntu@<IP>\"", "ansible_ssh_user": "ubuntu", ... }
When I run a simple ping call against this host from ansible, I get the following:
`
~/Projects/ansible-test $ ansible -vvvi …/ansible-dyn-inv/ter-inv.py consul-0 -m ping
<10.114.76.209> ESTABLISH CONNECTION FOR USER: ubuntu
<10.114.76.209> REMOTE_MODULE ping
<10.114.76.209> EXEC ssh -C -tt -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/tim/.ansible/cp/ansible-ssh-%h-%p-%r” -o StrictHostKeyChecking=no -o IdentityFile=“$KEYDIR/consul.pem” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ubuntu -o ConnectTimeout=10 10.114.76.209 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1442389916.8-56077513601101 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1442389916.8-56077513601101 && echo $HOME/.ansible/tmp/ansible-tmp-1442389916.8-56077513601101’
consul-0 | FAILED => SSH Error: ssh: connect to host 10.114.76.209 port 22: Connection timed out
while connecting to 10.114.76.209:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
`
As you can see, ansible_ssh_host, ansible_ssh_user, and ansible_ssh_private_key_file have all been set properly, but ansible_ssh_args is ignored.
``
Any ideas?