CentOS 7.6安装使用Ansible

服务器规划

IP操作系统主机名服务器角色
192.168.74.133CentOS   7.6 x86_64host133Ansible主机
192.168.74.132CentOS   7.6 x86_64host132被管控主机
192.168.74.134CentOS   7.6 x86_64host134被管控主机

在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