在使用python ansible模块为新主机执行ansible playbook时,我们可以忽略要求在.ssh目录中添加主机吗?

时间:2017-09-18 12:22:17

标签: python python-2.7 ansible ansible-inventory

目前,它要求输入是或否,我想忽略或传入程序本身,

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的代码可以参考问题,

' NoneType'对象没有属性' upper'使用ansible-python模块运行playbook?

1 个答案:

答案 0 :(得分:2)

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

有多种方法可以实现这一目标。例如,在ansible.cfg

中设置此项
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no