在使用 Ansible 部署的時候提示:
fatal: [*.*.*.*]: FAILED! => {"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."}
錯誤和原因
上面的錯誤資訊的主要原因是我們遠端到 SSH 伺服器上。
在我們 SSH 到伺服器上的時候,SSH 會提示是否需要儲存 key,這個時候我們需要選擇 Yes 或者 No。
但,Ansible 是不具備輸入參數的能力的。
是以我們需要将 host_key_checking 這個配置設定為 False。
配置檔案
配置檔案位于:/etc/ansible/ansible.cfg
是以我們可以對這個檔案進行編輯。
添加上面的參數後重新部署。