使用ansible批量部署证书文件出错

使用ansible批量部署证书文件出错

报错截图如下
在这里插入图片描述
信息如下:

[root@ansible idchost]# ansible all -m authorized_key -a “user=root exclusive=true manage_dir=true key=’$(< /root/.ssh/id_rsa.pub)’” -k
SSH password:
cache.com | FAILED! => {
“msg”: “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.”
}
db2.com | FAILED! => {
“msg”: “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.”
}
web1.com | FAILED! => {
“msg”: “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.”
}
db1.com | FAILED! => {
“msg”: “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.”
}
192.168.1.75 | FAILED! => {
“msg”: “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第一次登陆服务器需要输入yes/no ;信息存入本机/root/.ssh/known_hosts
解决方法:
在您所要执行ansible的目录下修改ansible.cfg

#cd 你所要执行的目录
#echo "host_key_checking = False" >>ansible.cfg        //禁用SSH密钥主机检查

再次执行即成功
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_38900565/article/details/84433549