# Proposal to add ansible\_ssh\_config inventory parameter

**URL:** <https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265>\
**Category:** Ansible Project\
**Created:** [August 6, 2013, 11:28pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265 "2013-08-06T23:28:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil777x](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@phil777x](https://forum.ansible.com/u/phil777x)\
**Post date:** [August 6, 2013, 11:28pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/1 "2013-08-06T23:28:32Z")

</div>

Hello all,

First, being new to ansible and the ansible community, and having already this proposal rejected in a pull request ([https://github.com/ansible/ansible/pull/3756](https://github.com/ansible/ansible/pull/3756))  
let me know if the path I’m taking to have my arguments heard is the good one and I do not hurt or annoy anyone.

I began with a problem I’m far from the only one to have: using ssh jump hosts.  
Apparently, the only ways to manage it with ansible are either via ANSIBLE\_SSH\_ARGS/ansible.cfg or via an entry in ~/.ssh/config.

The first is far from convenient:

- According to [http://www.ansibleworks.com/docs/gettingstarted.html#id4](http://www.ansibleworks.com/docs/gettingstarted.html#id4), if you use ANSIBLE\_SSH\_ARGS you loose the “sensible ControlMaster options”.

- These parameters are system-wide/user-wide, and outside of the ansible

- I want to version my ansible playbooks/inventory

- I expect my ansible playbooks/inventory to be playable on any out-of-the-box ansible installation, like you’d expect any PDF file to open on any PDF reader out of the box.

The second is also inconvenient

- it’s a user-wide setting
- you cannot version it with your playbooks/inventory because it is outside of it

I stumbled upon somebody with same needs that proposed a ansible\_ssh\_proxy\_cmd inventory parameter  
[https://github.com/ansible/ansible/pull/2970](https://github.com/ansible/ansible/pull/2970)

that would solve my problems but I find this solution in either not generic enough or not specific enough.

So that would be nice to have a ansible\_ssh\_jump\_host for instance, like we already have ansible\_ssh\_user, ansible\_ssh\_port,  
ansible\_ssh\_host. Why not also add ansible\_ssh\_known\_hosts\_file, or ansible\_ssh\_verify\_host\_key\_dns, or any of the bazillions ssh parameters.  
But that would make a lot of parameters in the inventory file which goal seems to be more about listing and grouping hosts.

On the other hand, why not separate the the inventory and the connections parameters. ssh config file is good enough to explain how to connect to a host  
(user, real name, identity file to use, proxy command, know\_host file to use, etc.) already working with every option you’d happen to need.

But, as I already said, I think that:

- using ~/.ssh/config is not nice
- using ansible.cfg or ANSIBLE\_SSH\_ARGS to relocate ssh config into ansible playbook/inventory repository is also not nice
- what if we would like to use several ssh config files according to inventory groups ?

Hence, I think ansible\_ssh\_config is a light and convenient way to

- integrate ssh config files into the inventory/playbook repository
- have this repository be self-sufficient and work from any host with a working ansible installation (git clone + point ansible to cloned repository + ansible-playbook my\_playbook) as anyone would expect
- permit to separate inventory and description on how to connect to hosts

I hope that was not too long. I’m ready for the suggestions/critics/flames?/anything.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 7, 2013, 1:53am UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/2 "2013-08-07T01:53:20Z")

</div>

> if you use ANSIBLE\_SSH\_ARGS you loose the “sensible ControlMaster options”.

This is not the case, you can pass in whatever arguments you wish to pass in, including ControlMaster/ControlPersist.

The user who wanted the ProxyCommand parameter was asking for the same kind of option sprawl that resulted in this command being rejected – because if you want to set individual ProxyCommands, you can specify an SSH config usign ANSIBLE\_SSH\_ARGS or the configuration file to specify a configuration file that sets this up on a per host basis pretty easily.

There isn’t a reason to add a parameter for every possible SSH configuration parameter in Ansible _UNLESS_ ansible needs to have significant behavior changes when those parameters are used.

As for your arguments that it are “not nice”, I disagree! It’s quite nice and ultimately flexible, and presenting a SSH option for every single flag in OpenSSH quickly results in unmanageable option sprawl.

---

<div class="post-metadata">

**Author:** ![phil777x](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@phil777x](https://forum.ansible.com/u/phil777x)\
**Post date:** [August 7, 2013, 1:20pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/3 "2013-08-07T13:20:39Z")

</div>

> > if you use ANSIBLE\_SSH\_ARGS you loose the “sensible ControlMaster options”.
> 
> This is not the case, you can pass in whatever arguments you wish to pass in, including ControlMaster/ControlPersist.

What I understood is that you have to pass them again. Hence it’s not a matter of doing  
ANSIBLE\_SSH\_ARGS=“-F new\_ssh\_config”  
but  
ANSIBLE\_SSH\_ARGS=“-F new\_ssh\_config -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=/tmp/ansible-ssh-%h-%p-%r”  
and this is only good for today ansible version. Maybe this could change one day.

We can reasonably assume that ansible developers chose the optimal options for the best experience using ansible with ssh (robustness, performance, security, etc.).  
Each time somebody use ANSIBLE\_SSH\_ARGS, to change an unrelated behavior (like the place to look for a config file in this case), he has

- to find parameters used by ansible and put them again in this variable, plus his little variation
- when upgrading to any new version of ansible, to check whether these parameters evolved to keep in sync.

Hence, IMHO, ANSIBLE\_SSH\_ARGS is a valuable option for a slight temporary behavior change, not for a production configuration.

> The user who wanted the ProxyCommand parameter was asking for the same kind of option sprawl that resulted in this command being rejected – because if you want to set individual ProxyCommands, you can specify an SSH config usign ANSIBLE\_SSH\_ARGS or the configuration file to specify a configuration file that sets this up on a per host basis pretty easily.
> 
> There isn’t a reason to add a parameter for every possible SSH configuration parameter in Ansible _UNLESS_ ansible needs to have significant behavior changes when those parameters are used.

Sorry that was not very clear on my first post. My paragraph about having bazillions of ssh options was exactly to say what you say: you can’t have all of them there. I completely agree on this. And that’s also an argument about having an  
ansible\_ssh\_config that could help you deprecate ansible\_ssh\_(user|private\_key\_file|host|port) (except if they are really used to change ansible behavior, but I’m not familiar with the code yet)

> As for your arguments that it are “not nice”, I disagree! It’s quite nice and ultimately flexible,

What I would like is this scenario:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 7, 2013, 1:43pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/4 "2013-08-07T13:43:31Z")

</div>

“and this is only good for today ansible version. Maybe this could change one day.”

These are options to OpenSSH, not Ansible, so if Ansible chooses to change OpenSSH defaults it won’t really affect your personal choices.

“We can reasonably assume that ansible developers chose the optimal options for the best experience using ansible with ssh”

You’re speaking to the primary author of Ansible here. They are reasonable defaults.

“My paragraph about having bazillions of ssh options was exactly to say what you say: you can’t have all of them there.”

You can specify -f to specify a configuration file if you have too many options and want to load them from a different configuration file.

“What I would avoid is … it’s not working”.

Sounds like you need to set up a Wiki.

---

<div class="post-metadata">

**Author:** ![phil777x](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@phil777x](https://forum.ansible.com/u/phil777x)\
**Post date:** [August 7, 2013, 2:18pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/5 "2013-08-07T14:18:25Z")

</div>

> “and this is only good for today ansible version. Maybe this could change one day.”
> 
> These are options to OpenSSH, not Ansible, so if Ansible chooses to change OpenSSH defaults it won’t really affect your personal choices.

What if my personal choice is: “whatever ansible developers (i.e. you) find optimal + my deviation” ?

> “We can reasonably assume that ansible developers chose the optimal options for the best experience using ansible with ssh”
> 
> You’re speaking to the primary author of Ansible here. They are reasonable defaults.

That’s exactly why I don’t want to mess with them. You make my point.

> “What I would avoid is … it’s not working”.
> 
> Sounds like you need to set up a Wiki.

You also make my point here. Your proposed solution force me to make non-standard hacks that need to be documented while my proposed modification would enable to fulfill those needs in a standard and clean way.

Also you did not answer to all my arguments.

Maybe my proposed solution is not the best one. Maybe there are better ways to do it. I don’t want to force this pull request in. Maybe somebody (including you) will come with another better proposal. I only really feel I’m asking for a hammer and you keep telling me you already provide a screwdriver and that should be sufficient to drive a nail. Did I behave incorrectly ?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 7, 2013, 2:44pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/6 "2013-08-07T14:44:09Z")

</div>

I don’t feel you are asking for a hammer per se, but rather a minor tweak to add an extra option for your specific use case because you didn’t like how something worked.

I’ve already given you an answer that we are not going to add the option.

Generally speaking, if I reject a pull request, appealing to the mailing list will not get it to go further.

Controlling option sprawl is important and there are numerous solutions to this question already provided.

---

<div class="post-metadata">

**Author:** ![phil777x](https://avatars.discourse-cdn.com/v4/letter/p/d6d6ee/32.png) [@phil777x](https://forum.ansible.com/u/phil777x)\
**Post date:** [August 7, 2013, 2:55pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/7 "2013-08-07T14:55:23Z")

</div>

Fine then, thanks for your time.

Best regards,  
Phil.

---

<div class="post-metadata">

**Author:** ![bryan\_hunt1](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bryan\_hunt1](https://forum.ansible.com/u/bryan_hunt1)\
**Post date:** [January 2, 2014, 12:25pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/8 "2014-01-02T12:25:23Z")

</div>

Sorry to resurrect an old post.

I’m trying to get ansible/vagrant integration working.

Vagrant uses a generated inventory file to communicate with Ansible.

But it is not setting Ansible to perform agent forwarding.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [January 2, 2014, 9:52pm UTC](https://forum.ansible.com/t/proposal-to-add-ansible-ssh-config-inventory-parameter/13265/9 "2014-01-02T21:52:27Z")

</div>

“But it is not setting Ansible to perform agent forwarding.”

I’m glad it’s not, that would be a very bad default.

SSH options are configurable via ansible.cfg.

[http://docs.ansible.com/intro\_configuration.html#ssh-args](http://docs.ansible.com/intro_configuration.html#ssh-args)
