配置yum的epel源
bash
[root@control ~]# yum -y install epel-release.noarch
[root@control ~]# yum repolist
repo id repo name
appstream Rocky Linux 9 - AppStream
baseos Rocky Linux 9 - BaseOS
epel Extra Packages for Enterprise Linux 9 - x86_64
epel-cisco-openh264 Extra Packages for Enterprise Linux 9 openh264 (From Cisco) - x86_64
extras Rocky Linux 9 - Extras
安装ansible
bash
[root@control ~]# yum -y install ansible
[root@control ~]# ansible --version
ansible [core 2.14.9]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.18 (main, Sep 7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
配置hosts文件
bash
[root@control ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.136 control
192.168.100.137 manage1
192.168.100.138 manage2
192.168.100.139 manage3
配置免密登录
bash
[root@control ~]# ssh-keygen
[root@control ~]# ssh-copy-id manage1
[root@control ~]# ssh-copy-id manage2
[root@control ~]# ssh-copy-id manage3