Installing Ansible on Rocky Linux 8

Step 1: Update System Packages for DNF

# dnf update

Step 2: Install EPEL for Rocky Linux 8

Install EPEL (Extra Packages for Enterprise Linux) repository to provide additional packages not included in the base repository

# dnf install epel-release -y

Step 3: Install Ansible Packages

# dnf install ansible

Step 4: Check the version

# ansible --version