Point Ansible at alternate ssh config file

28 views
Skip to first unread message

Jeff Richards

unread,
Feb 15, 2017, 1:50:39 PM2/15/17
to Ansible Project
I'm trying to have Ansible use an alternate ssh config file (i.e. not ~/.ssh/config).

My understanding was that you achieve this via adding a -F option in ssh_args in /etc/ansible/ansible.cfg. So my ssh_args now looks like this:

[ssh_connection]
ssh_args = -C -F ~/.ssh/collated-configs -o ControlMaster=auto -o ControlPersist=30m -o ControlPath=/tmp/ansible-ssh-%h-%p-%r

but collated-configs never gets referenced.

Any thoughts appreciated.

Jeff

Matt Martz

unread,
Feb 15, 2017, 3:37:17 PM2/15/17
to ansible...@googlegroups.com
Jeff,

If memory serves me correctly, you have to use a full path to the config, and cannot use ~

This is due to the ssh command not being executed via a shell, so shell expansions do not happen.

I have a similar configuration in my ansible.cfg and it works without issue.

--
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-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/082367b7-f684-4061-ba77-742d383ece6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net

Jeff Richards

unread,
Feb 15, 2017, 4:23:19 PM2/15/17
to Ansible Project
Hey Matt,

Tried it both ways, makes no difference.

With verbosity cranked up, I can see that it's reading the default .ssh/config file.

But interestingly, although the debug does show:
"Using /etc/ansible/ansible.cfg as config file"

and that contains:
ssh_args = -C -F /home/user01/.ssh/collated-configs -o ControlMaster=auto -o Co
st=30m -o ControlPath=/tmp/ansible-ssh-%h-%p-%r

the SSH: debug does not reflect any of those ssh_args.

So if we're not reading /etc/ansible/ansible.cfg at all, that would explain this behavior. But what would cause that to silently fail?

Jeff


On Wednesday, February 15, 2017 at 12:37:17 PM UTC-8, Matt Martz wrote:
Jeff,

If memory serves me correctly, you have to use a full path to the config, and cannot use ~

This is due to the ssh command not being executed via a shell, so shell expansions do not happen.

I have a similar configuration in my ansible.cfg and it works without issue.
On Wed, Feb 15, 2017 at 12:50 PM, Jeff Richards <richar...@gmail.com> wrote:
I'm trying to have Ansible use an alternate ssh config file (i.e. not ~/.ssh/config).

My understanding was that you achieve this via adding a -F option in ssh_args in /etc/ansible/ansible.cfg. So my ssh_args now looks like this:

[ssh_connection]
ssh_args = -C -F ~/.ssh/collated-configs -o ControlMaster=auto -o ControlPersist=30m -o ControlPath=/tmp/ansible-ssh-%h-%p-%r

but collated-configs never gets referenced.

Any thoughts appreciated.

Jeff

--
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.
Reply all
Reply to author
Forward
0 new messages