当前位置: 首页 >> Linux >> 【排错】安装ansible执行命令报错 >> 正文

【排错】安装ansible执行命令报错

4年前 (2019-11-25)     作者:Jiaozn     分类:Linux     阅读次数:2115     评论(0)    

执行的命令

ansible -k -i /etc/ansible/hosts 192.168.0.32 -m command -a "df -h"

错误提示

192.168.0.32 | FAILED | rc=-1 >>
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/known_hosts文件中并有fingerprint key串,ssh第一次连接的时候一般会提示输入yes 进行确认为将key字符串加入到  ~/.ssh/known_hosts 文件中。 


操作方法

在ansible.cfg配置文件中,也会找到如下部分: 

# uncomment this to disable SSH key host checking 
host_key_checking = False

默认host_key_checking部分是注释的,通过找开该行的注释,同样也可以实现跳过 ssh 首次连接提示验证部分。由于配置文件中直接有该选项


除非注明,发表在“Jiaozn的博客”的文章『【排错】安装ansible执行命令报错』版权归Jiaozn所有。 转载请注明出处为“本文转载于『Jiaozn的博客』原地址https://www.jiaozn.com/reed/543.html
0

评论

发表评论   

昵称*

E-mail*(建议输入,以便收到博主回复的提示邮件)

网站

分享:

支付宝

微信