# Ansible not picking up ansible\_ssh\_args with dynamic inventory

**URL:** <https://forum.ansible.com/t/ansible-not-picking-up-ansible-ssh-args-with-dynamic-inventory/19274>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 16, 2015, 8:01am UTC](https://forum.ansible.com/t/ansible-not-picking-up-ansible-ssh-args-with-dynamic-inventory/19274 "2015-09-16T08:01:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim.simon.contractor](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@tim.simon.contractor](https://forum.ansible.com/u/tim.simon.contractor)\
**Post date:** [September 16, 2015, 8:01am UTC](https://forum.ansible.com/t/ansible-not-picking-up-ansible-ssh-args-with-dynamic-inventory/19274/1 "2015-09-16T08:01:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [September 17, 2015, 12:00pm UTC](https://forum.ansible.com/t/ansible-not-picking-up-ansible-ssh-args-with-dynamic-inventory/19274/2 "2015-09-17T12:00:49Z")

</div>

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.
