方法一: ~/.ansible.cfg配置增加 host_key_checking = False:
host_key_checking = False
[defaults] host_key_checking = False
方法二: 增加环境变量:
$ export ANSIBLE_HOST_KEY_CHECKING=False
创建一个Host Inventory multinode
multinode
[control] # These hostname must be resolvable from your deployment host zjn01 zjn02 zjn03
[root@zjn-deploy workstation]# ansible -i multinode all -m shell -a "echo 'UseDNS no' >> /etc/ssh/sshd_config;systemctl restart sshd"
传参数的方式执行一个playbook,例如:
state: "" ansible-playbook -e state=present/absent