Here is how to install Ansible on Rocky Linux 9 in 2026. Tested and verified.
Install Ansible
# Enable EPEL repository
sudo dnf install -y epel-release
# Install Ansible
sudo dnf install -y ansible-core
# Or install full Ansible package
sudo dnf install -y ansibleAlternative: pip Installation
sudo dnf install -y python3-pip
pip3 install ansible --user
echo 'export PATH=$PATH:$HOME/.local/bin' >> ~/.bashrc
source ~/.bashrcVerify
ansible --version
ansible localhost -m pingInstall Collections
ansible-galaxy collection install community.general
ansible-galaxy collection install ansible.posix
ansible-galaxy collection install redhat.rhel_system_roles
