ansible - error - Using a SSH password instead of a key is not possible

参考并感谢
ansible 配置面密登陆

ansible asb -m authorized_key -a "user=wfq key='{{ lookup('file','/home/wfq/.ssh/id_rsa.pub') }}'" -k

-k是指命令行直接输入密码;

报错,如下

192.168.174.132 | FAILED => 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 文件中

基于这个原因,可以修改/etc/ansible/ansible.cfg配置文件

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

默认host_key_checking部分是注释的,打开该行的注释,可以实现跳过 ssh 首次连接提示验证部分。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值