我们可以忽略要求在.ssh目录中添加主机时,同时使用Python Ansible模块为新主机执行Ansible Play



当前,它要求输入我要忽略或传递程序本身的是或否,

TASK [Gathering Facts] ************************************************************************************************************************
The authenticity of host '192.168.112.188 (192.168.112.188)' can't be established.
ECDSA key fingerprint is SHA256:UoKxAB0x6sxQCggsklebbnxhdadajdjvsbbb5w.
Are you sure you want to continue connecting (yes/no)? 

如果您想查看Ansible的代码,可以参考该问题,

使用Ansible-Python模块运行剧本时,没有属性'upper'?

您应该更改StrictHostKeyChecking SSH客户端选项。

有多种方法可以实现这一目标。例如,将其设置在您的ansible.cfg中:

[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no

最新更新