Skip to main content
📬 Get weekly Production AI insights Practical notes on Kubernetes, AI infrastructure and platform engineering. No spam. Subscribe free
Install Ansible on RHEL 9
DevOps

Install Ansible on RHEL 9: Complete Guide (2026)

Install Ansible on RHEL 9 in 2026. Official repository setup, package installation, post-install configuration, and troubleshooting.

LB
Luca Berton
· 1 min read

Here is how to install Ansible on RHEL 9. Tested and verified.

Prerequisites

  • RHEL 9 installed, registered with Red Hat Subscription Manager, and updated
  • Root or sudo access
  • Internet connection

Step 1: Update System

sudo dnf update -y

Step 2: Enable the EPEL Repository

Ansible isn’t in RHEL’s base or AppStream repositories — it’s distributed through the community-maintained EPEL (Extra Packages for Enterprise Linux) repository. Enable the CodeReady Builder repository first, since several EPEL packages depend on it, then install the EPEL release package:

# Enable the CodeReady Builder repository
sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms

# Install the EPEL release package
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

Note: on Rocky Linux, AlmaLinux, and other RHEL rebuilds, epel-release is already available directly via sudo dnf install -y epel-release — see Install Ansible on Rocky Linux 9. True RHEL needs the extra steps above because EPEL isn’t enabled by an active subscription by default.

Step 3: Install Ansible

sudo dnf install -y ansible-core

Or install the “batteries included” package with bundled community collections:

sudo dnf install -y ansible

Step 4: Verify Installation

ansible --version
ansible localhost -m ping

Expected output shows the installed version, followed by a "ping": "pong" response.

Step 5: Verify Collections and Configuration

# List installed collections
ansible-galaxy collection list

# Install additional collections as needed
ansible-galaxy collection install community.general
ansible-galaxy collection install redhat.rhel_system_roles

# Inspect the active configuration
ansible-config view

Ansible is agentless and has no daemon or background service — it connects to managed hosts over SSH only when you run a command or playbook, so there is nothing to systemctl enable or check with systemctl status.

Alternative: pip Installation

sudo dnf install -y python3-pip
pip3 install ansible --user
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc
source ~/.bashrc

This avoids EPEL entirely and is useful when you can’t enable third-party repositories on a locked-down RHEL host. For a fully isolated setup, see Install Ansible with pip in a Virtual Environment.

Troubleshooting

Package Not Found

Confirm EPEL is actually enabled before installing:

sudo dnf clean all && sudo dnf makecache
dnf repolist | grep -i epel

Subscription / Entitlement Errors

If subscription-manager repos --enable ... fails with a message like “This system is not registered” or “Unable to find available repositories,” your host isn’t registered or attached to a subscription yet:

sudo subscription-manager register
sudo subscription-manager attach --auto

Uninstall

sudo dnf remove -y ansible ansible-core

About the Author

I am Luca Berton, AI and Cloud Advisor. Book a consultation to get help with your infrastructure setup.

Free 30-min Production AI consultation

Book Now