使用ansible的时候,出现如下秘钥失效的问题:
root@jumpserver ftp]# ansible web -m ping
The authenticity of host 'web-0005 (192.168.1.106)' can't be established.
ECDSA key fingerprint is SHA256:R/65aqDq4vDdAc/X0ReiVyxiTb4/qAkKdDapX1Py1N0.
ECDSA key fingerprint is MD5:ba:d7:f1:57:31:fe:70:5a:5b:ee:5d:18:fd:8f:88:86.
Are you sure you want to continue connecting (yes/no)? The authenticity of host 'web-0001 (192.168.1.234)' can't be established.
ECDSA key fingerprint is SHA256:H39rbtE/IJb/ORF56vXEQAx0etQ00hSvSKDnP12h9qk.
ECDSA key fingerprint is MD5:d1:fb:64:17:99:6e:f6:59:64:8b:5d:de:03:f5:a0:d0.
Are you sure you want to continue connecting (yes/no)? The authenticity of host 'web-0003 (192.168.1.40)' can't be established.
ECDSA key fingerprint is SHA256:wNBDHCyxLF3Mpx9K5/dkwkuGKc2RdLiNJd9E0ebMR1c.
ECDSA key fingerprint is MD5:39:2e:04:13:4c:dc:1b:a1:ec:22:bf:6c:a7:f1:17:ee.
Are you sure you want to continue connecting (yes/no)? The authenticity of host 'web-0002 (192.168.1.39)' can't be established.
ECDSA key fingerprint is SHA256:lAgSvljOs2pq5pdziSuhLaxWYIhuLBpk2NZ34fQmd2k.
ECDSA key fingerprint is MD5:2e:94:7f:27:d1:fd:84:ba:93:ba:37:dd:86:8b:cb:1c.
解决办法:
在配置文件[root@jumpserver ftp]# vim /etc/ssh/ssh_config中写入两行命令:(最好写在文件的末尾,便于维护)
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
再次执行命令,成功.
[root@jumpserver ftp]# ansible web -m ping
web-0003 | SUCCESS => {
"changed": false,
"ping": "pong"
}
web-0004 | SUCCESS => {
"changed": false,
"ping": "pong"
}
web-0005 | SUCCESS => {
"changed": false,
"ping": "pong"
}
web-0001 | SUCCESS => {
"changed": false,