使用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安裝是否成功,輸出下圖所示,則表示成功。