If you are using RHEL 8 then you can use the subscription manager to get Ansible with the host and config file pre-built.

Also, you will need to create an account on https://developers.redhat.com before you can do this:

subscription-manager register --auto-attach

subscription-manager repos --enable ansible-2.8-for-rhel-8-x86_64-rpms

yum -y install ansible

ansible --version
Answer from Aryan Srivastava on Stack Overflow
🌐
Ansible
docs.ansible.com › ansible › latest › installation_guide › intro_installation.html
Installing Ansible — Ansible Community Documentation
The ansible or ansible-core packages may be available in your operating systems package manager, and you are free to install these packages with your preferred method. For more information, see the Installing Ansible on specific operating systems guide.
🌐
Linux Hint
linuxhint.com › install_ansible_centos8
How to Install Ansible on CentOS 8 – Linux Hint
April 3, 2020 - Ansible is available in the EPEL repository of CentOS 8. So, you can easily install Ansible on CentOS 8.
🌐
Cloud Infrastructure Services
cloudinfrastructureservices.co.uk › home › blog › how to install ansible on centos 8 server
How to Install Ansible on CentOS 8 Server
September 17, 2025 - First, you will need to install the Ansible package on the control node. You can install Ansible via DNF or PIP command. By default, the Ansible package is not included in the CentOS default repo.
🌐
TecMint
tecmint.com › home › linux distros › centos › how to install ansible automation tool on centos/rhel 8
How to Install Ansible Automation Tool on CentOS/RHEL 8
October 8, 2019 - # subscription-manager repos --enable ansible-2.8-for-rhel-8-x86_64-rpms # dnf -y install ansible · That’s it for RHEL 8. For CentOS 8, ansible was traditionally distributed via EPEL.
🌐
Simplilearn
simplilearn.com › home › resources › devops › ansible tutorial › how to install and configure ansible on centos
How to Install and Configure Ansible on CentOS
February 2, 2026 - Amongst the configuration management tools, Ansible is unique. So what is Ansible & how to install it? Learn the Ansible installation & configuration on CentOS.
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
ComputingForGeeks
computingforgeeks.com › home › ansible › install and configure ansible on rhel 8 / centos 8
Install and Configure Ansible on RHEL 8 / CentOS 8 | ComputingForGeeks
June 11, 2020 - Install and Set your default Python on RHEL 8 using the guide below. ... Once it has been installed, proceed to install Pip which is a Python package manager used to install Ansible. If you’re using Python3, install python3-pip package. sudo dnf -y install python3-pip sudo pip3 install --upgrade pip ... There are two methods from which you can install Ansible on CentOS 8 / RHEL 8.
🌐
Aventis Tech
aventistech.com › home › how to install ansible on centos 8
How to Install Ansible on CentOS 8 -
$ ansible --version ansible 2.9.14 config file = /etc/ansible/ansible.cfg configured module search path = ['/home/kwyong/.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, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
🌐
ITzGeek
itzgeek.com › home › how to's › linux › centos/redhat › how to install & configure ansible on centos 8 / rhel 8
How To Install & Configure Ansible on CentOS 8 / RHEL 8 | ITzGeek
September 27, 2020 - ### CentOS 8 ### yum install -y epel-release ### RHEL 8 ### subscription-manager repos --enable ansible-2.9-for-rhel-8-x86_64-rpms · Install Ansible with yum command. ... Once Ansible is installed, verify the version of Ansible by executing ...
Find elsewhere
🌐
YouTube
youtube.com › londoniac / dennis mccarthy / automation engineer
[one minute] How to install Ansible on centos8 - YouTube
In this demo, I show you how to install Ansible using pip on Centos 8. Follow along as I show you each step required to install ANsible successfully and be r...
Published   April 30, 2021
Views   1K
🌐
GoLinuxCloud
golinuxcloud.com › home › centos 8 › beginners guide to install ansible on rhel/centos 8
Beginners guide to install Ansible on RHEL/CentOS 8 | GoLinuxCloud
January 2, 2024 - So you can now install ansible.noarch rpm on the controller node using dnf or yum · [root@controller ~]# dnf install -y ansible.noarch · In the next method for CentOS 8 install ansbile you can also use pip.
🌐
FOSS TechNix
fosstechnix.com › home › how to install ansible on centos 8
How to Install Ansible on CentOS 8
March 6, 2022 - In this article we have covered How to install Ansible on CentOS 8, Configure Ansible, exchanged SSH keys from master to slave node and Tested the Ansible setup.
🌐
Ansible Pilot
ansiblepilot.com › articles › how-to-install-ansible-in-centos-8-stream
How to install Ansible in CentOS 8 Stream
Master Ansible automation with expert tutorials, practical examples, and resources. Learn from Luca Berton's books and guides on DevOps, Kubernetes, and cloud infrastructure.
🌐
GoLinuxCloud
golinuxcloud.com › home › ansible tutorial › ansible installation guide on rhel/centos 8
Ansible Installation Guide on RHEL/CentOS 8 | GoLinuxCloud
January 1, 2024 - Next as normal user initiate the installation process: [deepak@centos8-2 ~]$ pip3 install ansible --user Collecting ansible Downloading https://files.pythonhosted.org/packages/32/62/eec759cd8ac89a866df1aba91abf785 486fed7774188a41f42f5c7326...
🌐
LinuxTechi
linuxtechi.com › home › how to › how to install ansible (automation tool) on centos 8/rhel 8
How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8
December 11, 2019 - Learn how to install and configure Ansible on CentOS 8 and RHEL 8 Server. Ansible is an automation and open source configuration tool.
Top answer
1 of 2
2

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 of 2
0

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
🌐
CentLinux
centlinux.com › home › ansible › install ansible control node on centos 8
Install Ansible Control Node on CentOS 8 | CentLinux
November 9, 2025 - In this article, you will learn how to install Ansible Control Node on CentOS 8. Later, we will also configure an Ansible managed node and execute some adhoc commands on it.
🌐
Stack Overflow
stackoverflow.com › questions › 58107029 › how-to-install-ansible-on-centos8
python - How to install Ansible on CentOS8 - Stack Overflow
Error: Problem: conflicting requests - nothing provides python-setuptools needed by ansible-2.8.5-1.el7.ans.noarch - nothing provides python-six needed by ansible-2.8.5-1.el7.ans.noarch - nothing provides PyYAML needed by ansible-2.8.5-1.el7.ans.noarch - nothing provides python-jinja2 needed by ansible-2.8.5-1.el7.ans.noarch - nothing provides python-paramiko needed by ansible-2.8.5-1.el7.ans.noarch - nothing provides python2-cryptography needed by ansible-2.8.5-1.el7.ans.noarch - nothing provides sshpass needed by ansible-2.8.5-1.el7.ans.noarch (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages) then tried to deploy these packages but no success · [root@okd1 ~]# pip3 install python-setuptools WARNING: Running pip install with root privileges is generally not a good idea.
🌐
Medium
ansiblepilot.medium.com › how-to-install-ansible-in-centos-8-de44c9b14824
How to install Ansible in CentOS 8 | by Luca Berton | Medium
July 28, 2023 - The easier way to install the latest version of Ansible and maintain up-to-date in CentOS 8 using the EPEL repository
🌐
Ansible Pilot
ansiblepilot.com › articles › how-to-install-ansible-in-centos-8
How to install Ansible in CentOS 8
Master Ansible automation with expert tutorials, practical examples, and resources. Learn from Luca Berton's books and guides on DevOps, Kubernetes, and cloud infrastructure.