ansible playbook error:UNREACHABLE argument must be an int, or have a fileno() method

在执行ansible-playbook时,通过-i指定了inventory文件,并且文件中有host、user、password,仍然报错:UNREACHABLE argument must be an int, or have a fileno() method。

通过排查问题,发现/home/.ansible.config文件被删除,导致其中defaults配置组中的host_key_checking配置项没有了。

解决方法:

检查ansible默认的配置文件中,是否配置了host_key_checking=False。

通过inventory:

ansible_ssh_common_args='-o StrictHostKeyChecking=no'

通过host:

ansible_ssh_extra_args='-o StrictHostKeyChecking=no'
 

global配置:

1、在/etc/ansible/ansible.cfg or ~/.ansible.cfg中配置:

[defaults]
host_key_checking = False

2、命令行:

ansible-playbook -e 'host_key_checking=False' yourplaybook.yml

3、环境变量:

export ANSIBLE_HOST_KEY_CHECKING=False
扫描二维码关注公众号,回复: 5133594 查看本文章

参考文档:https://stackoverflow.com/questions/23074412/how-to-set-host-key-checking-false-in-ansible-inventory-file

猜你喜欢

转载自www.cnblogs.com/xiaoerlang/p/10341210.html
今日推荐