ansible认证主机时,可以密码认证和公钥认证共存。密码认证时:
报以上错误,说明控制机缺少sshpass组件,根据自己的安装程序自行安装即可:
本人主机系统为ubuntu20.04.4,使用apt安装:
sudo apt install -y sshpass
再次尝试连接目标主机,一般可以正常访问,若像小主一样,遇到报错: "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/known_hosts文件中并有fingerprint key串,使用ssh连接目标主机时,一般会提示是否将key字符串加入到~/.ssh/known_hosts文件中,若选择yes,则本机以后再次使用shh连接目标主机时,不会弹出确