基于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)]