【ansible】api 調用出現ssh交互式輸入


 發現在刪掉 ~/.ssh/know_hosts 之后運行 ansible api 會出現以下提示

The authenticity of host '10.1.*.* (10.1.*.*)' can't be established.
RSA key fingerprint is 43:54:a5:c0:f8:4a:a2:d2:1a:ef:87:8f:90:f5:dd:4a.
Are you sure you want to continue connecting (yes/no)?

因為在腳本里面自動運行調用,無法使用 pexpect 模塊,也無法捕捉到 這段提示的輸出,ansible 源碼研究不夠透徹搞了半天也沒解決,最后只能從根本途徑上面解決問題,直接修改 ssh 配置,去掉該段提示。

vim /etc/ssh/ssh_config 


Host *
    StrictHostKeyChecking no

重啟 sshd

service sshd restart

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM