服务器规划
IP | 操作系统 | 主机名 | 服务器角色 |
192.168.74.133 | CentOS 7.6 x86_64 | host133 | Ansible主机 |
192.168.74.132 | CentOS 7.6 x86_64 | host132 | 被管控主机 |
192.168.74.134 | CentOS 7.6 x86_64 | host134 | 被管控主机 |
在ansible主机上生成密匙对
ssh-keygen -t rsa -P ""
复制公钥至所有被管控主机
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.74.132
ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.74.134
在ansible主机上安装以下模块
yum -y install epel-release
yum -y install ansible
Ansible主机配置被管控主机的主机清单文件
vim /etc/ansible/hosts
[hosts]
192.168.74.132
192.168.74.134