Ansible Pilot

Install Ansible on AlmaLinux 8 Easily with EPEL

Step-by-Step Guide to Installing Ansible on AlmaLinux 8

Learn how to install and maintain Ansible on AlmaLinux 8 using the EPEL repository. Follow this simple guide to set up Ansible efficiently on your system.
December 16, 2021
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

YouTube Video

How to install Ansible in AlmaLinux version 8.

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

How to install Ansible in AlmaLinux 8

Today we’re talking about how to install Ansible in AlmaLinux 8. The easier way to install and maintain Ansible inside AlmaLinux 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), AlmaLinux and Scientific Linux (SL), Oracle Linux (OL).

demo

Install latest Ansible release in AlmaLinux 8.

code

#!/bin/bash
sudo yum install epel-release
sudo yum install ansible

execution

$ ssh [email protected]
[devops@almalinux ~]$ sudo su
[root@almalinux devops]# cat /etc/redhat-release 
AlmaLinux release 8.5 (Arctic Sphynx)
[root@almalinux devops]# cat /etc/os-release 
NAME="AlmaLinux"
VERSION="8.5 (Arctic Sphynx)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="AlmaLinux 8.5 (Arctic Sphynx)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:almalinux:almalinux:8::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"
ALMALINUX_MANTISBT_PROJECT="AlmaLinux-8"
ALMALINUX_MANTISBT_PROJECT_VERSION="8.5"
[root@almalinux devops]# hostnamectl 
   Static hostname: almalinux.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 2125d84a5a894596a126819adab153e8
           Boot ID: 6a16f6345f3442e78a3c4814e24f479c
    Virtualization: oracle
  Operating System: AlmaLinux 8.5 (Arctic Sphynx)
       CPE OS Name: cpe:/o:almalinux:almalinux:8::baseos
            Kernel: Linux 4.18.0-348.2.1.el8_5.x86_64
      Architecture: x86-64
[root@almalinux devops]# uname -a
Linux almalinux.example.com 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@almalinux devops]# dnf install epel-release
Last metadata expiration check: 0:50:44 ago on Tue 07 Dec 2021 09:26:05 AM UTC.
Dependencies resolved.
===================================================================================================
 Package                    Architecture         Version                Repository            Size
===================================================================================================
Installing:
 epel-release               noarch               8-10.el8               extras                22 k
Transaction Summary
===================================================================================================
Install  1 Package
Total download size: 22 k
Installed size: 32 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-8-10.el8.noarch.rpm                                   251 kB/s |  22 kB     00:00    
---------------------------------------------------------------------------------------------------
Total                                                               36 kB/s |  22 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1 
  Installing       : epel-release-8-10.el8.noarch                                              1/1 
  Running scriptlet: epel-release-8-10.el8.noarch                                              1/1 
  Verifying        : epel-release-8-10.el8.noarch                                              1/1
Installed:
  epel-release-8-10.el8.noarch
Complete!
[root@almalinux devops]# dnf search ansible
Extra Packages for Enterprise Linux 8 - x86_64                     3.2 MB/s |  11 MB     00:03    
Extra Packages for Enterprise Linux Modular 8 - x86_64             1.2 MB/s | 980 kB     00:00    
================================== Name Exactly Matched: ansible ==================================
ansible.noarch : SSH-based configuration management, deployment, and task execution system
================================= Name & Summary Matched: ansible =================================
ansible-collection-ansible-posix.noarch : Ansible Collection targeting POSIX and POSIX-ish
                                        : platforms
ansible-collection-community-general.noarch : Modules and plugins supported by Ansible community
ansible-collection-microsoft-sql.noarch : The Ansible collection for Microsoft SQL Server
                                        : management
ansible-collection-redhat-rhel_mgmt.noarch : Ansible Collection of general system management and
                                           : utility modules and other plugins
ansible-doc.noarch : Documentation for Ansible
ansible-freeipa-tests.noarch : ansible-freeipa tests
ansible-pcp.noarch : Ansible Metric collection for Performance Co-Pilot
ansible-test.noarch : Tool for testing ansible plugin and module code
centos-release-ansible-29.noarch : Ansible 2.9 packages from the CentOS ConfigManagement SIG
                                 : repository
python-sphinx_ansible_theme-doc.noarch : A reusable Ansible Sphinx Theme
python3-ansible-lint.noarch : Best practices checker for Ansible
python3-sphinx_ansible_theme.noarch : A reusable Ansible Sphinx Theme
vim-ansible.noarch : Vim plugin for syntax highlighting ansible\'s common filetypes
====================================== Name Matched: ansible ======================================
ansible-freeipa.noarch : Roles and playbooks to deploy FreeIPA servers, replicas and clients
==================================== Summary Matched: ansible =====================================
ara.noarch : Records Ansible playbooks and makes them easier to understand and troubleshoot
paternoster.noarch : Allows to run ansible playbooks like ordinary python or bash scripts
python3-ara.noarch : Records Ansible playbooks and makes them easier to understand and troubleshoot
standard-test-roles.noarch : Standard Test Interface Ansible roles
[root@almalinux devops]# dnf info ansible
Last metadata expiration check: 0:00:19 ago on Tue 07 Dec 2021 10:17:11 AM UTC.
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@almalinux devops]# dnf install ansible
Last metadata expiration check: 0:00:29 ago on Tue 07 Dec 2021 10:17:11 AM UTC.
Dependencies resolved.
===================================================================================================
 Package                  Arch       Version                                   Repository     Size
===================================================================================================
Installing:
 ansible                  noarch     2.9.27-1.el8                              epel           17 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        238 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      45 k
 python3-markupsafe       x86_64     0.23-19.el8                               appstream      39 k
 python3-pip              noarch     9.0.3-20.el8                              appstream      19 k
 python3-ply              noarch     3.9-9.el8                                 baseos        110 k
 python3-pyasn1           noarch     0.3.7-6.el8                               appstream     126 k
 python3-pycparser        noarch     2.14-14.el8                               baseos        109 k
 python3-pynacl           x86_64     1.3.0-5.el8                               epel          100 k
 python3-pytz             noarch     2017.2-9.el8                              appstream      54 k
 python3-setuptools       noarch     39.2.0-6.el8                              baseos        162 k
 python36                 x86_64     3.6.8-38.module_el8.5.0+2569+5c5719bc     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
Total download size: 24 M
Installed size: 127 M
Is this ok [y/N]: y
Downloading Packages:
(1/19): python3-ply-3.9-9.el8.noarch.rpm                           671 kB/s | 110 kB     00:00    
(2/19): python3-cffi-1.11.5-5.el8.x86_64.rpm                       1.3 MB/s | 238 kB     00:00    
(3/19): python3-pycparser-2.14-14.el8.noarch.rpm                   1.6 MB/s | 109 kB     00:00    
(4/19): python3-setuptools-39.2.0-6.el8.noarch.rpm                 1.8 MB/s | 162 kB     00:00    
(5/19): python3-cryptography-3.2.1-5.el8.x86_64.rpm                1.5 MB/s | 558 kB     00:00    
(6/19): python3-jmespath-0.9.0-11.el8.noarch.rpm                   679 kB/s |  45 kB     00:00    
(7/19): python3-markupsafe-0.23-19.el8.x86_64.rpm                  617 kB/s |  39 kB     00:00    
(8/19): python3-pip-9.0.3-20.el8.noarch.rpm                        639 kB/s |  19 kB     00:00    
(9/19): python3-jinja2-2.10.1-3.el8.noarch.rpm                     1.8 MB/s | 537 kB     00:00    
(10/19): python3-pyasn1-0.3.7-6.el8.noarch.rpm                     2.0 MB/s | 126 kB     00:00    
(11/19): python3-pytz-2017.2-9.el8.noarch.rpm                      1.1 MB/s |  54 kB     00:00    
(12/19): python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64.rpm 506 kB/s |  18 kB     00:00    
(13/19): libsodium-1.0.18-2.el8.x86_64.rpm                         1.6 MB/s | 162 kB     00:00    
(14/19): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm                   1.7 MB/s |  44 kB     00:00    
(15/19): python3-paramiko-2.4.3-1.el8.noarch.rpm                   1.7 MB/s | 289 kB     00:00    
(16/19): python3-pynacl-1.3.0-5.el8.x86_64.rpm                     1.3 MB/s | 100 kB     00:00    
(17/19): sshpass-1.06-9.el8.x86_64.rpm                             670 kB/s |  27 kB     00:00    
(18/19): python3-babel-2.5.1-7.el8.noarch.rpm                      2.8 MB/s | 4.8 MB     00:01    
(19/19): ansible-2.9.27-1.el8.noarch.rpm                           3.5 MB/s |  17 MB     00:04    
---------------------------------------------------------------------------------------------------
Total                                                              3.7 MB/s |  24 MB     00:06     
Extra Packages for Enterprise Linux 8 - x86_64                     1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x2F86D6A1:
 Userid     : "Fedora EPEL (8) <[email protected]>"
 Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Is this ok [y/N]: y
Key imported successfully
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/19 
  Installing       : python3-pip-9.0.3-20.el8.noarch                                          2/19 
  Installing       : python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64                    3/19 
  Running scriptlet: python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64                    3/19 
  Installing       : sshpass-1.06-9.el8.x86_64                                                4/19 
  Installing       : libsodium-1.0.18-2.el8.x86_64                                            5/19 
  Installing       : python3-pytz-2017.2-9.el8.noarch                                         6/19 
  Installing       : python3-babel-2.5.1-7.el8.noarch                                         7/19 
  Installing       : python3-pyasn1-0.3.7-6.el8.noarch                                        8/19 
  Installing       : python3-markupsafe-0.23-19.el8.x86_64                                    9/19 
  Installing       : python3-jinja2-2.10.1-3.el8.noarch                                      10/19 
  Installing       : python3-jmespath-0.9.0-11.el8.noarch                                    11/19 
  Installing       : python3-ply-3.9-9.el8.noarch                                            12/19 
  Installing       : python3-pycparser-2.14-14.el8.noarch                                    13/19 
  Installing       : python3-cffi-1.11.5-5.el8.x86_64                                        14/19 
  Installing       : python3-cryptography-3.2.1-5.el8.x86_64                                 15/19 
  Installing       : python3-bcrypt-3.1.6-2.el8.1.x86_64                                     16/19 
  Installing       : python3-pynacl-1.3.0-5.el8.x86_64                                       17/19 
  Installing       : python3-paramiko-2.4.3-1.el8.noarch                                     18/19 
  Installing       : ansible-2.9.27-1.el8.noarch                                             19/19 
  Running scriptlet: ansible-2.9.27-1.el8.noarch                                             19/19 
  Verifying        : python3-cffi-1.11.5-5.el8.x86_64                                         1/19 
  Verifying        : python3-cryptography-3.2.1-5.el8.x86_64                                  2/19 
  Verifying        : python3-ply-3.9-9.el8.noarch                                             3/19 
  Verifying        : python3-pycparser-2.14-14.el8.noarch                                     4/19 
  Verifying        : python3-setuptools-39.2.0-6.el8.noarch                                   5/19 
  Verifying        : python3-babel-2.5.1-7.el8.noarch                                         6/19 
  Verifying        : python3-jinja2-2.10.1-3.el8.noarch                                       7/19 
  Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                     8/19 
  Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                    9/19 
  Verifying        : python3-pip-9.0.3-20.el8.noarch                                         10/19 
  Verifying        : python3-pyasn1-0.3.7-6.el8.noarch                                       11/19 
  Verifying        : python3-pytz-2017.2-9.el8.noarch                                        12/19 
  Verifying        : python36-3.6.8-38.module_el8.5.0+2569+5c5719bc.x86_64                   13/19 
  Verifying        : ansible-2.9.27-1.el8.noarch                                             14/19 
  Verifying        : libsodium-1.0.18-2.el8.x86_64                                           15/19 
  Verifying        : python3-bcrypt-3.1.6-2.el8.1.x86_64                                     16/19 
  Verifying        : python3-paramiko-2.4.3-1.el8.noarch                                     17/19 
  Verifying        : python3-pynacl-1.3.0-5.el8.x86_64                                       18/19 
  Verifying        : sshpass-1.06-9.el8.x86_64                                               19/19
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.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+2569+5c5719bc.x86_64  
  sshpass-1.06-9.el8.x86_64
Complete!
[root@almalinux 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, Nov  9 2021, 16:02:49) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
[root@almalinux devops]# dnf info ansible
Last metadata expiration check: 0:01:21 ago on Tue 07 Dec 2021 10:17:11 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@almalinux devops]#

before execution

# dnf info ansible
Last metadata expiration check: 0:00:19 ago on Tue 07 Dec 2021 10:17:11 AM UTC.
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.

after execution

# dnf info ansible
Last metadata expiration check: 0:01:21 ago on Tue 07 Dec 2021 10:17:11 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.

code with ❤️ in GitHub

Recap

Now you know how to install the latest version of Ansible in AlmaLinux 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

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

Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons
Follow me

Subscribe not to miss any new releases