How to install Ansible in Rocky Linux version 8. Today we’re going to talk about the easier way to install and maintain Ansible inside Rocky Linux 8 using the EPEL repository. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

How to install Ansible in Rocky Linux 8

  • use Extra Packages for Enterprise Linux (EPEL) additional packages for Enterprise Linux: Red Hat Enterprise Linux (RHEL), Rocky Linux and Scientific Linux (SL), Oracle Linux (OL)

Today we’re talking about How to install Ansible in Rocky Linux 8. The easier way to install and maintain Ansible inside Rocky Linux version 8 is using the Extra Packages for Enterprise Linux (EPEL) additional repository. This repository is maintained by the Fedora Special Interest Group and manages a high-quality set of additional packages for Enterprise Linux: Red Hat Enterprise Linux (RHEL), Rocky Linux and Scientific Linux (SL), Oracle Linux (OL).

Playbook

Let’s jump in a quick live Playbook of how to install the latest version of Ansible in Rocky Linux.

code

  • Install-Ansible-RockyLinux8.sh
#!/bin/bash
sudo dnf install epel-release
sudo dnf install ansible
ansible --version

execution

$ ssh [email protected]
[devops@rockylinux ~]$ sudo su
[root@rockylinux devops]# cat /etc/redhat-release 
Rocky Linux release 8.4 (Green Obsidian)
[root@rockylinux devops]# dnf info ansible
Rocky Linux 8 - AppStream                                          3.2 MB/s | 8.2 MB     00:02    
Rocky Linux 8 - BaseOS                                             3.6 MB/s | 3.5 MB     00:00    
Rocky Linux 8 - Extras                                              27 kB/s |  10 kB     00:00    
Error: No matching Packages to list
[root@rockylinux devops]# dnf install epel-release
Last metadata expiration check: 0:00:12 ago on Fri 19 Nov 2021 08:56:15 AM UTC.
Dependencies resolved.
===================================================================================================
 Package                    Architecture         Version                Repository            Size
===================================================================================================
Installing:
 epel-release               noarch               8-13.el8               extras                23 k
Transaction Summary
===================================================================================================
Install  1 Package
Total download size: 23 k
Installed size: 35 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-8-13.el8.noarch.rpm                                   241 kB/s |  23 kB     00:00    
---------------------------------------------------------------------------------------------------
Total                                                               65 kB/s |  23 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1 
  Installing       : epel-release-8-13.el8.noarch                                              1/1 
  Running scriptlet: epel-release-8-13.el8.noarch                                              1/1 
  Verifying        : epel-release-8-13.el8.noarch                                              1/1
Installed:
  epel-release-8-13.el8.noarch
Complete!
[root@rockylinux devops]# dnf info ansible
Extra Packages for Enterprise Linux Modular 8 - x86_64             2.2 MB/s | 958 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                     4.4 MB/s |  11 MB     00:02    
Available Packages
Name         : ansible
Version      : 2.9.27
Release      : 1.el8
Architecture : noarch
Size         : 17 M
Source       : ansible-2.9.27-1.el8.src.rpm
Repository   : epel
Summary      : SSH-based configuration management, deployment, and task execution system
URL          : http://ansible.com
License      : GPLv3+
Description  : Ansible is a radically simple model-driven configuration management,
             : multi-node deployment, and remote task execution system. Ansible works
             : over SSH and does not require any software or daemons to be installed
             : on remote nodes. Extension modules can be written in any language and
             : are transferred to managed machines automatically.

[root@rockylinux devops]# dnf install ansible
Last metadata expiration check: 0:00:23 ago on Fri 19 Nov 2021 08:56:41 AM UTC.
Dependencies resolved.
===================================================================================================
Package                  Arch       Version                                   Repository     Size
===================================================================================================
Installing:
ansible                  noarch     2.9.27-1.el8                              epel           17 M
Upgrading:
chkconfig                x86_64     1.19.1-1.el8                              baseos        197 k
platform-python-pip      noarch     9.0.3-20.el8.rocky.0                      baseos        1.7 M
Installing dependencies:
libsodium                x86_64     1.0.18-2.el8                              epel          162 k
python3-babel            noarch     2.5.1-7.el8                               appstream     4.8 M
python3-bcrypt           x86_64     3.1.6-2.el8.1                             epel           44 k
python3-cffi             x86_64     1.11.5-5.el8                              baseos        237 k
python3-cryptography     x86_64     3.2.1-5.el8                               baseos        558 k
python3-jinja2           noarch     2.10.1-3.el8                              appstream     537 k
python3-jmespath         noarch     0.9.0-11.el8                              appstream      44 k
python3-markupsafe       x86_64     0.23-19.el8                               appstream      38 k
python3-pip              noarch     9.0.3-20.el8.rocky.0                      appstream      19 k
python3-ply              noarch     3.9-9.el8                                 baseos        110 k
python3-pyasn1           noarch     0.3.7-6.el8                               appstream     125 k
python3-pycparser        noarch     2.14-14.el8                               baseos        108 k
python3-pynacl           x86_64     1.3.0-5.el8                               epel          100 k
python3-pytz             noarch     2017.2-9.el8                              appstream      53 k
python3-setuptools       noarch     39.2.0-6.el8                              baseos        162 k
python36                 x86_64     3.6.8-38.module+el8.5.0+671+195e4563      appstream      18 k
sshpass                  x86_64     1.06-9.el8                                epel           27 k
Installing weak dependencies:
python3-paramiko         noarch     2.4.3-1.el8                               epel          289 k
Enabling module streams:
python36                            3.6

Transaction Summary
===================================================================================================
Install  19 Packages
Upgrade   2 Packages

Total download size: 26 M
Is this ok [y/N]: y
Downloading Packages:
(1/21): python3-jmespath-0.9.0-11.el8.noarch.rpm                   281 kB/s |  44 kB     00:00
(2/21): python3-markupsafe-0.23-19.el8.x86_64.rpm                  880 kB/s |  38 kB     00:00
(3/21): python3-pip-9.0.3-20.el8.rocky.0.noarch.rpm                436 kB/s |  19 kB     00:00
(4/21): python3-jinja2-2.10.1-3.el8.noarch.rpm                     2.1 MB/s | 537 kB     00:00
(5/21): python3-pytz-2017.2-9.el8.noarch.rpm                       1.2 MB/s |  53 kB     00:00
(6/21): python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64.rpm   1.1 MB/s |  18 kB     00:00
(7/21): python3-pyasn1-0.3.7-6.el8.noarch.rpm                      1.3 MB/s | 125 kB     00:00
(8/21): python3-cffi-1.11.5-5.el8.x86_64.rpm                       1.1 MB/s | 237 kB     00:00
(9/21): python3-ply-3.9-9.el8.noarch.rpm                           1.6 MB/s | 110 kB     00:00
(10/21): python3-pycparser-2.14-14.el8.noarch.rpm                  1.4 MB/s | 108 kB     00:00
(11/21): python3-cryptography-3.2.1-5.el8.x86_64.rpm               1.6 MB/s | 558 kB     00:00
(12/21): python3-setuptools-39.2.0-6.el8.noarch.rpm                1.9 MB/s | 162 kB     00:00
(13/21): libsodium-1.0.18-2.el8.x86_64.rpm                         1.4 MB/s | 162 kB     00:00
(14/21): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm                   1.3 MB/s |  44 kB     00:00
(15/21): python3-paramiko-2.4.3-1.el8.noarch.rpm                   942 kB/s | 289 kB     00:00
(16/21): python3-pynacl-1.3.0-5.el8.x86_64.rpm                     1.3 MB/s | 100 kB     00:00
(17/21): sshpass-1.06-9.el8.x86_64.rpm                             934 kB/s |  27 kB     00:00
(18/21): chkconfig-1.19.1-1.el8.x86_64.rpm                         2.2 MB/s | 197 kB     00:00
(19/21): platform-python-pip-9.0.3-20.el8.rocky.0.noarch.rpm       2.4 MB/s | 1.7 MB     00:00
(20/21): python3-babel-2.5.1-7.el8.noarch.rpm                      1.7 MB/s | 4.8 MB     00:02
(21/21): ansible-2.9.27-1.el8.noarch.rpm                           3.9 MB/s |  17 MB     00:04
---------------------------------------------------------------------------------------------------
Total                                                              4.6 MB/s |  26 MB     00:05
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing        :                                                                           1/1
Installing       : python3-setuptools-39.2.0-6.el8.noarch                                   1/23
Upgrading        : platform-python-pip-9.0.3-20.el8.rocky.0.noarch                          2/23
Upgrading        : chkconfig-1.19.1-1.el8.x86_64                                            3/23
Installing       : python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64                     4/23
Running scriptlet: python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64                     4/23
Installing       : python3-pip-9.0.3-20.el8.rocky.0.noarch                                  5/23
Installing       : sshpass-1.06-9.el8.x86_64                                                6/23
Installing       : libsodium-1.0.18-2.el8.x86_64                                            7/23
Installing       : python3-ply-3.9-9.el8.noarch                                             8/23
Installing       : python3-pycparser-2.14-14.el8.noarch                                     9/23
Installing       : python3-cffi-1.11.5-5.el8.x86_64                                        10/23
Installing       : python3-cryptography-3.2.1-5.el8.x86_64                                 11/23
Installing       : python3-bcrypt-3.1.6-2.el8.1.x86_64                                     12/23
Installing       : python3-pynacl-1.3.0-5.el8.x86_64                                       13/23
Installing       : python3-pytz-2017.2-9.el8.noarch                                        14/23
Installing       : python3-babel-2.5.1-7.el8.noarch                                        15/23
Installing       : python3-pyasn1-0.3.7-6.el8.noarch                                       16/23
Installing       : python3-paramiko-2.4.3-1.el8.noarch                                     17/23
Installing       : python3-markupsafe-0.23-19.el8.x86_64                                   18/23
Installing       : python3-jinja2-2.10.1-3.el8.noarch                                      19/23
Installing       : python3-jmespath-0.9.0-11.el8.noarch                                    20/23
Installing       : ansible-2.9.27-1.el8.noarch                                             21/23
Cleanup          : platform-python-pip-9.0.3-19.el8.rocky.noarch                           22/23
Cleanup          : chkconfig-1.13-2.el8.x86_64                                             23/23
Running scriptlet: chkconfig-1.13-2.el8.x86_64                                             23/23
Verifying        : python3-babel-2.5.1-7.el8.noarch                                         1/23
Verifying        : python3-jinja2-2.10.1-3.el8.noarch                                       2/23
Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                     3/23
Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                    4/23
Verifying        : python3-pip-9.0.3-20.el8.rocky.0.noarch                                  5/23
Verifying        : python3-pyasn1-0.3.7-6.el8.noarch                                        6/23
Verifying        : python3-pytz-2017.2-9.el8.noarch                                         7/23
Verifying        : python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64                     8/23
Verifying        : python3-cffi-1.11.5-5.el8.x86_64                                         9/23
Verifying        : python3-cryptography-3.2.1-5.el8.x86_64                                 10/23
Verifying        : python3-ply-3.9-9.el8.noarch                                            11/23
Verifying        : python3-pycparser-2.14-14.el8.noarch                                    12/23
Verifying        : python3-setuptools-39.2.0-6.el8.noarch                                  13/23
Verifying        : ansible-2.9.27-1.el8.noarch                                             14/23
Verifying        : libsodium-1.0.18-2.el8.x86_64                                           15/23
Verifying        : python3-bcrypt-3.1.6-2.el8.1.x86_64                                     16/23
Verifying        : python3-paramiko-2.4.3-1.el8.noarch                                     17/23
Verifying        : python3-pynacl-1.3.0-5.el8.x86_64                                       18/23
Verifying        : sshpass-1.06-9.el8.x86_64                                               19/23
Verifying        : chkconfig-1.19.1-1.el8.x86_64                                           20/23
Verifying        : chkconfig-1.13-2.el8.x86_64                                             21/23
Verifying        : platform-python-pip-9.0.3-20.el8.rocky.0.noarch                         22/23
Verifying        : platform-python-pip-9.0.3-19.el8.rocky.noarch                           23/23

Upgraded:
chkconfig-1.19.1-1.el8.x86_64           platform-python-pip-9.0.3-20.el8.rocky.0.noarch
Installed:
ansible-2.9.27-1.el8.noarch               libsodium-1.0.18-2.el8.x86_64
python3-babel-2.5.1-7.el8.noarch          python3-bcrypt-3.1.6-2.el8.1.x86_64
python3-cffi-1.11.5-5.el8.x86_64          python3-cryptography-3.2.1-5.el8.x86_64
python3-jinja2-2.10.1-3.el8.noarch        python3-jmespath-0.9.0-11.el8.noarch
python3-markupsafe-0.23-19.el8.x86_64     python3-paramiko-2.4.3-1.el8.noarch
python3-pip-9.0.3-20.el8.rocky.0.noarch   python3-ply-3.9-9.el8.noarch
python3-pyasn1-0.3.7-6.el8.noarch         python3-pycparser-2.14-14.el8.noarch
python3-pynacl-1.3.0-5.el8.x86_64         python3-pytz-2017.2-9.el8.noarch
python3-setuptools-39.2.0-6.el8.noarch    python36-3.6.8-38.module+el8.5.0+671+195e4563.x86_64
sshpass-1.06-9.el8.x86_64

Complete!
[root@rockylinux devops]# dnf info ansible
Last metadata expiration check: 0:00:55 ago on Fri 19 Nov 2021 08:56:41 AM UTC.
Installed Packages
Name         : ansible
Version      : 2.9.27
Release      : 1.el8
Architecture : noarch
Size         : 96 M
Source       : ansible-2.9.27-1.el8.src.rpm
Repository   : @System
From repo    : epel
Summary      : SSH-based configuration management, deployment, and task execution system
URL          : http://ansible.com
License      : GPLv3+
Description  : Ansible is a radically simple model-driven configuration management,
: multi-node deployment, and remote task execution system. Ansible works
: over SSH and does not require any software or daemons to be installed
: on remote nodes. Extension modules can be written in any language and
: are transferred to managed machines automatically.

[root@rockylinux devops]# ansible --version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /bin/ansible
python version = 3.6.8 (default, May 19 2021, 03:00:47) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
[root@rockylinux devops]# yum --showduplicates list ansible
Last metadata expiration check: 0:14:07 ago on Fri 19 Nov 2021 08:56:41 AM UTC.
Installed Packages
ansible.noarch                        2.9.27-1.el8                         @epel
Available Packages
ansible.noarch                        2.9.27-1.el8                         epel
[root@rockylinux devops]#

before execution

$ ssh [email protected]
[devops@rockylinux ~]$ sudo su
[root@rockylinux devops]# cat /etc/redhat-release 
Rocky Linux release 8.4 (Green Obsidian)
[root@rockylinux devops]# dnf info ansible
Rocky Linux 8 - AppStream                                          3.2 MB/s | 8.2 MB     00:02    
Rocky Linux 8 - BaseOS                                             3.6 MB/s | 3.5 MB     00:00    
Rocky Linux 8 - Extras                                              27 kB/s |  10 kB     00:00    
Error: No matching Packages to list

after execution

$ ssh [email protected]
[devops@rockylinux ~]$ sudo su
[root@rockylinux devops]# dnf info ansible
Last metadata expiration check: 0:00:55 ago on Fri 19 Nov 2021 08:56:41 AM UTC.
Installed Packages
Name         : ansible
Version      : 2.9.27
Release      : 1.el8
Architecture : noarch
Size         : 96 M
Source       : ansible-2.9.27-1.el8.src.rpm
Repository   : @System
From repo    : epel
Summary      : SSH-based configuration management, deployment, and task execution system
URL          : http://ansible.com
License      : GPLv3+
Description  : Ansible is a radically simple model-driven configuration management,
: multi-node deployment, and remote task execution system. Ansible works
: over SSH and does not require any software or daemons to be installed
: on remote nodes. Extension modules can be written in any language and
: are transferred to managed machines automatically.

[root@rockylinux devops]# ansible --version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /bin/ansible
python version = 3.6.8 (default, May 19 2021, 03:00:47) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
[root@rockylinux devops]# yum --showduplicates list ansible
Last metadata expiration check: 0:14:07 ago on Fri 19 Nov 2021 08:56:41 AM UTC.
Installed Packages
ansible.noarch                        2.9.27-1.el8                         @epel
Available Packages
ansible.noarch                        2.9.27-1.el8                         epel
[root@rockylinux devops]#

code with ❤️ in GitHub

Conclusion

Now you know how to install the latest version of Ansible in Rocky Linux using the EPEL repository. Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my Udemy 300+ Lessons Video Course.

BUY the Complete Udemy 300+ Lessons Video Course

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Patreon Buy me a Pizza