安裝和配置好ansible,執行命令時報錯以下shell
[root@test01 ansible-install]# ansible test -m shell -a 'w' 10.xx.37.26 | 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. 10.xx.37.25 | 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. 10.xx.37.24 | 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.
解決方法:併發
vi /etc/ansible/ansible.cfg [defaults] forks = 8 #執行時併發數 host_key_checking = False #不檢測host key