使用yum源安装Ansible报以下错误:
Error: Package: ansible-2.6.13-1.el6.noarch (epel)
Requires: python-simplejson
Error: Package: ansible-2.6.13-1.el6.noarch (epel)
Requires: python(abi) = 2.6
Installed: python-2.7.5-76.el7.x86_64 (@base)
python(abi) = 2.7
python(abi) = 2.7
Available: python-2.7.5-77.el7_6.x86_64 (updates)
python(abi) = 2.7
python(abi) = 2.7
Available: python34-3.4.8-1.el6.i686 (epel)
python(abi) = 3.4
Error: Package: python-jinja2-26-2.6-3.el6.noarch (epel)
Requires: python(abi) = 2.6
Installed: python-2.7.5-76.el7.x86_64 (@base)
python(abi) = 2.7
python(abi) = 2.7
Available: python-2.7.5-77.el7_6.x86_64 (updates)
python(abi) = 2.7
python(abi) = 2.7
Available: python34-3.4.8-1.el6.i686 (epel)
python(abi) = 3.4
Error: Package: python-crypto2.6-2.6.1-2.el6.x86_64 (epel)
Requires: libpython2.6.so.1.0()(64bit)
Error: Package: ansible-2.6.13-1.el6.noarch (epel)
Requires: /usr/bin/python2.6
Error: Package: python-crypto2.6-2.6.1-2.el6.x86_64 (epel)
Requires: python(abi) = 2.6
Installed: python-2.7.5-76.el7.x86_64 (@base)
python(abi) = 2.7
python(abi) = 2.7
Available: python-2.7.5-77.el7_6.x86_64 (updates)
python(abi) = 2.7
python(abi) = 2.7
Available: python34-3.4.8-1.el6.i686 (epel)
python(abi) = 3.4
You could try using --skip-broken to work around the problem
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
1:logstash-6.2.4-1.noarch is a duplicate with 1:logstash-2.3.4-1.noarch
php-bcmath-5.4.45-13.el7.remi.x86_64 has missing requires of php-common(x86-64) = ('0', '5.4.45', '13.el7.remi')
php-mbstring-5.4.45-13.el7.remi.x86_64 has missing requires of php-common(x86-64) = ('0', '5.4.45', '13.el7.remi')
原因:epel源与python版本冲突原因,从上图可以看出,有些包是需要依赖python2.6的版本,此主机的python版本是2.7.5。
解决办法:
1、先卸载 epel-release源,
#yum install epel-release -y
2、到 /etc/yum.repos.d 目录下,将epel.repo源备份,
#mv epel.repo epel.repo.bak
3、清理yum源缓存和新建缓存,
# yum clean all
# yum makecache
4、再执行安装命令:#yum install ansible -y
5、#ansible --version
检测Ansible安装是否成功,输出下图所示,则表示成功。