在ansible配置文件中找到 /etc/ansible/ansible.cfg
方法1
在配置文件中找到
了解到問題原因為,我們了解到進行ssh連接時,可以使用-o參數將StrictHostKeyChecking設置為no,使用ssh連接時避免首次連接時讓輸入yes/no部分的提示。通過查看ansible.cfg配置文件,發現如下行:
[ssh_connection] # ssh arguments to use # Leaving off ControlPersist will result in poor performance, so use # paramiko on older platforms rather than removing it #ssh_args = -o ControlMaster=auto -o ControlPersist=60s
修改配置文件:
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no
方法2
在配置文件中找到
# uncomment this to disable SSH key host checking host_key_checking = False
默認host_key_checking部分是注釋的,通過找開該行的注釋,同樣也可以實現跳過 ssh 首次連接提示驗證部分。由於配置文件中直接有該選項,所以推薦用方法2