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 › projects › ansible › latest › collections › ansible › builtin › yum_module.html
ansible.builtin.yum module — Ansible Community Documentation
This redirect is part of ansible-core and included in all Ansible installations. In most cases, you can use the short module name yum even without specifying the collections keyword.
🌐
Ansible
docs.ansible.com › projects › ansible › latest › installation_guide › intro_installation.html
Installing Ansible — Ansible Community Documentation
If you need to install dependencies from a requirements file, for example when installing the Azure collection, you can use runpip. $ pipx runpip ansible install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements.txt
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-and-configure-ansible-on-centos-7
How to Install and Configure Ansible on CentOS 7 | DigitalOcean
December 19, 2016 - To get Ansible for CentOS 7, first ensure that the CentOS 7 EPEL repository is installed: sudo yum install epel-release · Once the repository is installed, install Ansible with yum: sudo yum install ansible · We now have all of the software required to administer our servers through Ansible.
🌐
Red Hat
redhat.com › en › blog › ansible-quick-start
Quick start guide to Ansible for Linux sysadmins
November 24, 2025 - To install Ansible on the RHEL 8 control node after registering with the Satellite server, run the command yum install ansible.
🌐
Spacelift
spacelift.io › blog › how-to-install-ansible
How to Install Ansible on Ubuntu, RHEL, macOS & CentOS
sudo yum update -y sudo yum install epel-release sudo yum install ansible #Validate Ansible: ansible ---version
Published   October 10, 2025
🌐
Ansible
docs.ansible.com › ansible › 2.9 › installation_guide › intro_installation.html
Installing Ansible — Ansible Documentation
Technically, you can use Ansible ... you need to bootstrap Python 2 onto a RHEL-based system, you can install it as follows: $ ansible myhost --become -m raw -a "yum install -y python2"...
🌐
Ansible
docs.ansible.com › ansible › 2.9 › modules › yum_module.html
yum – Manages packages with the yum package manager — Ansible Documentation
Unmaintained Ansible versions can ... version. See the latest Ansible community documentation . For Red Hat customers, see the Red Hat AAP platform lifecycle. ... Installs, upgrade, downgrades, removes, and lists packages and groups with the yum package manager....
Find elsewhere
🌐
Red Hat
developers.redhat.com › blog › 2016 › 08 › 15 › install-ansible-on-rhel
Install Ansible on Red Hat Enterprise Linux | Red Hat Developer
March 16, 2023 - I’ll cover both in this article. Ansible is not available in the default RHEL repositories, so we need to install Extra Packages for Enterprise Linux (EPEL) in order to install it via yum.
🌐
Spacelift
spacelift.io › blog › ansible-yum-module
Ansible Yum Module : Installing & Removing Packages
Learn how to use the Ansible yum module to manage packages with yum package manager. See examples for single and multiple packages.
Published   October 17, 2025
🌐
Ansible
docs.ansible.com › ansible › 2.3 › yum_module.html
Ansible Documentation — Ansible Community Documentation
June 29, 2022 - Running Ansible with the community EE image · Installation, Upgrade & Configuration · Installation Guide · Installing Ansible · Installing Ansible on specific operating systems · Configuring Ansible · Ansible Porting Guides · Ansible 13 Porting Guide ·
🌐
Snel
snel.com › home › how to install ansible on centos 7
Learn How to install Ansible on CentOS 7 - Snel.com
May 21, 2019 - EPEL or Extra Packages for Enterprise Linux repository is a free and community based repository which provide many extra open source software packages which are not available in default YUM repository. We need to install EPEL repository into the system as Ansible is available in default YUM ...
🌐
Ansible
docs.ansible.com › ansible-core › 2.16 › collections › ansible › builtin › yum_module.html
ansible.builtin.yum module – Manages packages with the yum package manager — Ansible Core Documentation
February 9, 2026 - However, we recommend you use the Fully Qualified Collection Name (FQCN) ansible.builtin.yum for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name. Installs, upgrade, downgrades, removes, and lists packages and groups with the yum package manager.
🌐
Toptechskills
toptechskills.com › ansible-tutorials-courses › ansible-yum-module-tutorial-examples
Ansible yum Module Tutorial + Examples | TopTechSkills.com
May 18, 2024 - Ansible’s yum module is used to manage packages with the yum package manager, which is the default on Red Hat based Linux distributions such as Red Hat Enterprise Linux and CentOS. Most systems require root/superuser permissions to manage packages, which means that become: true is required. I recommend always using the update_cache: true parameter when installing ...
🌐
Ansible
docs.ansible.com › projects › ansible › latest › collections › ansible › builtin › yum_repository_module.html
ansible.builtin.yum_repository module – Add or remove YUM repositories — Ansible Community Documentation
- name: Add repository ansible.builtin.yum_repository: name: epel description: EPEL YUM repo baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/ - name: Add multiple repositories into the same file (1/2) ansible.builtin.yum_repository: name: epel description: EPEL YUM repo file: external_repos baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/ gpgcheck: no - name: Add multiple repositories into the same file (2/2) ansible.builtin.yum_repository: name: rpmforge description: RPMforge YUM repo file: external_repos baseurl: http://apt.sw.be/redhat/e
🌐
LabEx
labex.io › tutorials › ansible-how-to-use-ansible-for-yum-package-management-400136
How to Use Ansible for Yum Package Management | LabEx
You can use Ansible to ensure that all servers have the necessary packages installed and up-to-date, promoting consistency and reliability across your infrastructure. --- - hosts: webservers tasks: - name: Install common web packages yum: name: - httpd - php - mysql - wordpress state: present
🌐
Adam the Automator
adamtheautomator.com › install-ansible
How to Install Ansible (Ubuntu, RHEL, CentOS, macOS)
June 4, 2023 - The EPEL repository contains various system packages, including the Ansible package, which you will install in the next step. # Installing the epel-release package using the yum command yum install epel-release yum install epel-release
🌐
4sysops
4sysops.com › home › blog › articles › ansible yum module: install rhel/centos packages
Ansible yum module: Install RHEL/CentOS packages – 4sysops
August 30, 2023 - If it is already installed, Ansible will do nothing, as shown below: ... In this section, we will use state=latest to install the latest version of the package. Let's create a new playbook to install the latest version of Apache on the target server. ... - hosts: all tasks: - name : Install the latest Apache package yum: name=httpd state=latest update_cache=true
🌐
Virtono
virtono.com › community › tutorial-how-to › how-to-install-ansible-on-centos
How To Install Ansible On CentOS - Virtono Community
April 18, 2023 - Therefore, we need to install the EPEL (Extra Packages for Enterprise Linux) repository, which contains the Ansible package. To install the EPEL repository, run the following command: sudo yum install epel-release ·