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
🌐
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
🌐
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.
People also ask

How to check if Ansible is installed in Linux?
Run ansible –version in the terminal. If Ansible is installed, it will display the version and configuration details. If it’s not installed, you’ll see a “command not found” or similar error message.
🌐
spacelift.io
spacelift.io › blog › how-to-install-ansible
How to Install Ansible on Ubuntu, RHEL, macOS & CentOS
Is Ansible free to use?
Yes, Ansible is free to use under the GNU GPLv3 license. It’s open source and can be used, modified, and distributed at no cost. For enterprise features and official support, Red Hat offers a commercial version called Ansible Automation Platform.
🌐
spacelift.io
spacelift.io › blog › how-to-install-ansible
How to Install Ansible on Ubuntu, RHEL, macOS & CentOS
🌐
Ansible
docs.ansible.com › 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.
🌐
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.
🌐
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.
🌐
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"...
Find elsewhere
🌐
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
🌐
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 14 Porting Guide ·
🌐
Medium
medium.com › cloudnloud › how-to-install-a-package-using-ansible-6840dbe96896
How to install a package through Ansible playbook? | by sangeetha arun | Cloudnloud Tech Community | Medium
September 4, 2023 - To see the examples of yum module you can get by using the command ansible-doc yum ... Scroll down to bottom to see the examples. ... After you’ve created the file, paste the script below into package1.yaml. --- name: I am going to install package hosts: all tasks: - name: Install package yum: name: unzip state: latest
🌐
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 ·
🌐
Ansible
docs.ansible.com › ansible › 2.9 › modules › yum_module.html
yum – Manages packages with the yum package manager — Ansible Documentation
- name: install the latest version of Apache yum: name: httpd state: latest - name: ensure a list of packages installed yum: name: "{{ packages }}" vars: packages: - httpd - httpd-tools - name: remove the Apache package yum: name: httpd state: absent - name: install the latest version of Apache from the testing repo yum: name: httpd enablerepo: testing state: present - name: install one specific version of Apache yum: name: httpd-2.2.29-1.4.amzn1 state: present - name: upgrade all packages yum: name: '*' state: latest - name: upgrade all packages, excluding kernel & foo related packages yum: n
🌐
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
🌐
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
🌐
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 ...
🌐
LinuxBuz
linuxbuz.com › devops › ansible-yum-localinstall
Ansible yum localinstall: A Guide to Install Local RPMs
July 11, 2025 - The yum localinstall feature allows you to install RPM packages stored locally on your server. In this guide, we will explain how to use Ansible’s yum module with the localinstall feature to install RPM packages from local files.
🌐
Red Hat
learn.redhat.com › t5 › Platform-Linux › Installing-Ansible › td-p › 51144
Installing Ansible - Red Hat Learning Community
June 5, 2025 - Ansible can be installed on RHEL in one of following ways: # yum install ansible-core or # python3 -m pip install ansible Question: Is the final outcome of the installation different in any way, when using yum vs the python pip tool? Or does it just amount to 2 different ways t...
🌐
LinuxBuz
linuxbuz.com › linuxhowto › ansible-yum-module
Ansible yum module: Install RHEL/CentOS Packages
July 11, 2025 - Learn how to use Ansible's yum module to install and manage packages on RHEL, CentOS, and Rocky Linux with detailed examples and practical commands.
🌐
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 ...