一、安装ansible软件
1、安装yum源
rpm -Uvh http://mirrors.ustc.edu.cn/epel/epel-release-latest-7.noarch.rpm
yum install epel-release -y
yum install ansible
要是报错:epel源与python版本冲突原因,有些包是需要依赖python2.6的版本,此主机的python版本是2.7.5。
2、那就先卸载 epel-release源
yum install epel-release -y
3、到 /etc/yum.repos.d 目录下,将epel.repo源备份,
mv epel.repo epel.repo.bak
4、清理yum源缓存和新建缓存,
yum clean all
yum makecache
5、再执行安装命令
yum install ansible -y
6、查看安装的版本
ansible --version
[root@hadoop1 yum.repos.d]# ansible --version
ansible 2.9.16
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]