Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible: set ssh arguments using group variables

Tags:

ssh

ansible

To connect to different groups of hosts, I need to use different ssh config files. I'm currently trying to connect to both groups in the same playbook, but I can't figure out how to change ssh_args within the playbook. I was wondering if I could use group_vars to do this?

The way I currently set ssh_args is in ansible.cfg:

[ssh_connection]
ssh_args = -F ./ssh.cfg
like image 491
Joaquim d'Souza Avatar asked Oct 27 '25 03:10

Joaquim d'Souza


1 Answers

Yes, but you should use ansible_ssh_common_args, see List of Behavioral Inventory Parameters.

like image 93
Konstantin Suvorov Avatar answered Oct 29 '25 06:10

Konstantin Suvorov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!