權限方面:node
yum -y install ansible
host_key_checking
vim /etc/ansible/ansible.cfg host_key_checking = False
vim /etc/ansible/hosts [centos6] 192.168.22.1:22 ansible_ssh_user=wanghui ansible_ssh_pass='123456' ansible_sudo_pass='123456' [centos7] centos7-node1.abc.com:22 ansible_ssh_user=wanghui ansible_ssh_pass='123456' ansible_sudo_pass='123456'
ansible all -m shell -a "mkdir /root/test -p" -u wanghui --sudo
[centos-all] centos7-node1 ansible_ssh_host=192.168.56.11 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass='111' centos7-node2 ansible_ssh_host=192.168.56.12 ansible_ssh_port=22 ansible_ssh_user=root ansible_ssh_pass='111'