使用其他命令而不是 ssh for ansible
use other command instead of ssh for ansible
我有一个 ansible 配置,我知道它可以在我的本地机器上运行。但是,我现在正尝试在我公司的机器上设置它,它使用类似于 ssh 的包装命令(我们称之为 'myssh')
比如访问这些机器,而不是写
ssh myuser@123.123.123.123
你写
myssh myuser@123.123.123.123
最终会调用 ssh 等。
我的问题是,有没有办法交换 ansible 使用哪个命令访问机器?
您可以创建 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.
见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
。
最后再次在您的 ansible.cfg
中将 transport
setting 设置为您的新插件:
transport = myssh
PS:我以前从来没有做过这样的事情。这只是来自文档的信息。
我有一个 ansible 配置,我知道它可以在我的本地机器上运行。但是,我现在正尝试在我公司的机器上设置它,它使用类似于 ssh 的包装命令(我们称之为 'myssh')
比如访问这些机器,而不是写
ssh myuser@123.123.123.123
你写
myssh myuser@123.123.123.123
最终会调用 ssh 等。
我的问题是,有没有办法交换 ansible 使用哪个命令访问机器?
您可以创建 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.
见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
。
最后再次在您的 ansible.cfg
中将 transport
setting 设置为您的新插件:
transport = myssh
PS:我以前从来没有做过这样的事情。这只是来自文档的信息。