ansible学习 30 September 2016
分享按钮ansible第一次连接无法加入know_hosts
方法一:
~/.ansible.cfg配置增加 host_key_checking = False
:
[defaults]
host_key_checking = False
方法二: 增加环境变量:
$ export ANSIBLE_HOST_KEY_CHECKING=False
ansible第一个用法
批量对三个节点执行命令
创建一个Host Inventory multinode
[control]
# These hostname must be resolvable from your deployment host
zjn01
zjn02
zjn03
远程修改sshd配置
[root@zjn-deploy workstation]# ansible -i multinode all -m shell -a "echo 'UseDNS no' >> /etc/ssh/sshd_config;systemctl restart sshd"
playbook执行
传参数的方式执行一个playbook,例如:
state: ""
ansible-playbook -e state=present/absent
blog comments powered by Disqus