Monday, January 29, 2024

[SOLVED] use other command instead of ssh for ansible

Issue

I have an ansible configuration which I know works on my local machines. However, I'm trying to now set it up on my company's machines which use a wrapper command similar to ssh (let's call it 'myssh')

for example, to access these machines, instead of writing

ssh [email protected]

you write

myssh [email protected]

which ends up calling ssh, among other things.

My question is, is there a way to swap which command ansible uses for accessing machines?


Solution

You can create a Connection Type Plugin to archive this. Looking at the ssh plugin, it appears like it might be as easy as replacing the ssh_cmd in line 333. Also specify myssh in line 69.

See here where to place the modified file. Additionally to that information, you can specify a custom location and let Ansible know about it in connection_plugins setting in ansible.cfg.

Finally again in your ansible.cfg set the transport setting to your new plugin:

transport = myssh

PS: I have never done anything like that before. This is only info from the docs.



Answered By - udondan
Answer Checked By - Terry (WPSolving Volunteer)