# ssh client config referenced by ssh\_args in ansible.cfg

**URL:** <https://forum.ansible.com/t/ssh-client-config-referenced-by-ssh-args-in-ansible-cfg/29031>\
**Category:** Ansible Project\
**Created:** [November 14, 2018, 11:24pm UTC](https://forum.ansible.com/t/ssh-client-config-referenced-by-ssh-args-in-ansible-cfg/29031 "2018-11-14T23:24:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucky\_numbersevun](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@lucky\_numbersevun](https://forum.ansible.com/u/lucky_numbersevun)\
**Post date:** [November 14, 2018, 11:24pm UTC](https://forum.ansible.com/t/ssh-client-config-referenced-by-ssh-args-in-ansible-cfg/29031/1 "2018-11-14T23:24:32Z")

</div>

i have a ssh client config that works, and it has Host definition for the bastion at the top, and then all the inside hosts are listed below it in the same file with an appropriate ProxyCommand statement.

i have a directory at ~/repo/some-ansible-repo/

~/repo/some-ansible-repo/ansible.cfg looks like this:

`  
$ cat ./ansible.cfg  
[defaults]  
inventory = ./hosts  
host\_key\_checking = false  
deprecation\_warnings=false  
vault\_password\_file = …/vault\_password\_file\_blah

[ssh\_connection]  
ssh\_args=“-F ~/.ssh/dev-cluster.config -o ControlPath=/tmp/ansible-ssh-%h-%p-%r -o ControlMaster=auto -o ControlPersist=30m”  
control\_path = ~/.ansible/cp  
`

Ansible can connect to the bastion, but it cannot connect to any of the inside hosts unless the client config has:

`  
Include ~/.ssh/dev-cluster.config

`

Am I doing something wrong with ansible.cfg?  
Why is it ignoring my -F?

---

<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:** [November 14, 2018, 11:35pm UTC](https://forum.ansible.com/t/ssh-client-config-referenced-by-ssh-args-in-ansible-cfg/29031/2 "2018-11-14T23:35:53Z")

</div>

`ssh_args` cannot utilize shell expansions such as `~`.

On the command line this works because your shell expands it. In an ansible.cfg file, they are not expanded. You would need to use a full path with `-F`

---

<div class="post-metadata">

**Author:** ![lucky\_numbersevun](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@lucky\_numbersevun](https://forum.ansible.com/u/lucky_numbersevun)\
**Post date:** [November 15, 2018, 12:00am UTC](https://forum.ansible.com/t/ssh-client-config-referenced-by-ssh-args-in-ansible-cfg/29031/3 "2018-11-15T00:00:52Z")

</div>

Thank you for your response, actually, embarrassingly, i knew that. i apologize but i changed the full path to the file to protect the innocent. 🙂

So, what im saying is that im using full paths, and its still not picking up the whole config, it can only connect to the bastion.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 15, 2018, 5:32am UTC](https://forum.ansible.com/t/ssh-client-config-referenced-by-ssh-args-in-ansible-cfg/29031/4 "2018-11-15T05:32:12Z")

</div>

I doubt this will be the issue, but I see you’re supplying controlpath both directly as an ansible config option, and as part of the ssh\_args, and they have different values.

Could it be that this inconsistency somehow caused the -F argument to be ignored?

Can you try removing one of the two control path instances?

Dick

---

<div class="post-metadata">

**Author:** ![lucky\_numbersevun](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@lucky\_numbersevun](https://forum.ansible.com/u/lucky_numbersevun)\
**Post date:** [November 15, 2018, 7:07pm UTC](https://forum.ansible.com/t/ssh-client-config-referenced-by-ssh-args-in-ansible-cfg/29031/5 "2018-11-15T19:07:38Z")

</div>

i commented out the line you suggested, ensured i had the Include line in my default ssh client config commented out, and it can only connect to the bastion still. thank you for your suggestion.
