安装ansible时报错(nothing provides (ansible-core >= 2.12.2 with ansible-core < 2.13) needed by ansible-5)

基于centos8下载ansible时报版本过低错误

  • nothing provides (ansible-core >= 2.12.2 with ansible-core < 2.13) needed by ansible-5.4.0-3.el8.noarch
    (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)

产生如下的报错原因

[root@localhost ~]# dnf -y install ansible
CentOS-8.5.2111 - Base - mirrors.aliyun.com       7.2 kB/s | 3.9 kB     00:00    
CentOS-8.5.2111 - Extras - mirrors.aliyun.com     6.6 kB/s | 1.5 kB     00:00    
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com   23 kB/s | 4.3 kB     00:00    
Error: 
 Problem: cannot install the best candidate for the job
  - nothing provides (ansible-core >= 2.12.2 with ansible-core < 2.13) needed by ansible-5.4.0-3.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

解决

这里是由于centos官方停更了,导致使用阿里云的epel源下载不了,需要使用本地的epel源来使用
//删除即可

[root@localhost yum.repos.d]# ls
CentOS-Base.repo            epel-modular.repo  epel-testing-modular.repo
 epel.repo          epel-testing.repo
[root@localhost yum.repos.d]# rm -rf epel*
//配置本地epel源
[root@localhost yum.repos.d]# dnf list all|grep ansible
ansible.noarch                                         2.9.27-1.el8                                           @centos-ansible-29
centos-release-ansible-29.noarch                       1-2.el8                                                @extras          
[root@localhost ~]# dnf -y install centos-release-ansible-29-1-2.el8.noarch
[root@localhost yum.repos.d]#  ls /etc/yum.repos.d/ |grep ansible
CentOS-SIG-ansible-29.repo

//在次下载
[root@localhost yum.repos.d]# dnf -y install ansible
....................
Installed:
  ansible-2.9.27-1.el8.noarch            python3-babel-2.5.1-7.el8.noarch        
  python3-cffi-1.11.5-5.el8.x86_64       python3-cryptography-3.2.1-5.el8.x86_64 
  python3-jinja2-2.10.1-3.el8.noarch     python3-jmespath-0.9.0-11.el8.noarch    
  python3-markupsafe-0.23-19.el8.x86_64  python3-ply-3.9-9.el8.noarch            
  python3-pycparser-2.14-14.el8.noarch   python3-pytz-2017.2-9.el8.noarch        
  python3-pyyaml-3.12-12.el8.x86_64      sshpass-1.06-8.el8.x86_64               

Complete!

//查看版本完美解决
[root@localhost ~]# ansible --version
ansible 2.9.27
  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.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Jan 19 2022, 23:28:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-7)]
  • 6
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值