【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

 

posted @ 2017-07-20 16:06  RunningPower  阅读(2131)  评论(0编辑  收藏  举报