Ansible not picking up ansible_ssh_args with dynamic inventory

285 views
Skip to first unread message

tim.simon....@bbva.com

unread,
Sep 17, 2015, 6:42:49 AM9/17/15
to Ansible Project
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?

Matt Martz

unread,
Sep 17, 2015, 8:01:01 AM9/17/15
to ansible...@googlegroups.com
ansible_ssh_args did not exist in 1.9.3.  That functionality has been added for the upcoming 2.0 release.  Prior to 2.0 ssh_args was configured globally in an ansible.cfg file.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f7ac09cb-0770-4087-be40-68d77f04e15e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Reply all
Reply to author
Forward
0 new messages