skip to Main Content

In order to install Ansible on Centos 8; epel-release package needs to be installed. Due to Centos8 end of life, no new packages and security updates are not maintained and all repos has moved under vault.centos.org thus CentOS-* repos need to replace then we can install epel-release. Once you install epel-release ansilbe installation gives below error since June 2022.

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

2

Answers


  1. Chosen as BEST ANSWER

    The solutions for that I have created a small script it changes centos-repos and install epel-relase then changes epel's repo and install Ansible 2.9.27-1.el8 with all dependencies.

    #!/bin/bash
    set -ex
    
    # Add EPEL repository
    
    osV=$(rpm --eval '%{centos_ver}')
    
    if [ "$osV" == "8" ]; then
        cd /etc/yum.repos.d/
        sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
        sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
    
        sudo yum install -y epel-release
        sudo sed -i 's/metalink/#metalink/g' /etc/yum.repos.d/epel*
        sudo sed -i 's|#baseurl=https://download.example/pub/|baseurl=https://mirror.init7.net/fedora/|g' /etc/yum.repos.d/epel*
    else
       sudo yum install -y epel-release
    fi
    
    sudo yum install -y ansible
    

  2. I also stucked by this question,and centos version was 8.5.2111 (not centos stream)

    and i just manually download ansible-core.rpm and it’s dependency and install them,

    then i can install the ansible by dnf install ansible

    the detail step was:

    wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/ansible-core-2.12.2-3.el8.x86_64.rpm
    wget http://mirror.centos.org/centos/8-stream/AppStream/aarch64/os/Packages/python38-resolvelib-0.5.4-5.el8.noarch.rpm
    wget http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/sshpass-1.09-4.el8.x86_64.rpm
    rpm -ivh python38-resolvelib-0.5.4-5.el8.noarch.rpm
    rpm -ivh sshpass-1.09-4.el8.x86_64.rpm
    rpm -ivh ansible-core-2.12.2-3.el8.x86_64.rpm
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search