centos 192.168.81.100
centos 192.168.81.101
ansible-master
yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum -y install ansible-2.9.7-1.el7.ans.noarch.rpm
创建密匙对儿
ssh-keygen
ssh-copy-id root@192.168.81.101
修改hosts文件
vim /etc/ansible/hosts
[webserver]
192.168.81.101
主机是否在线
ansible all -m ping
192.168.81.101 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}