cixiren 发表于 2018-1-3 12:27:46

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  
页: [1]
查看完整版本: ansible api 调用出现ssh交互式输入