Ansible Pilot

How to install Ansible in CentOS 8 - Ansible install

The easier way to install and maintain Ansible inside CentOS 8 using the EPEL repository.

October 18, 2021
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

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

How to install Ansible in CentOS 8

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

The Best Resources For Ansible

Certifications

Video Course

Printed Book

eBooks

demo

Let’s jump in a quick live demo of how to install the latest and a specific version of Ansible in CentOS.

code

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

execution

output

# yum install epel-release
Last metadata expiration check: 0:00:59 ago on Mon 18 Oct 2021 01:41:22 PM UTC.
Package epel-release-8-11.el8.noarch is already installed.
Dependencies resolved.
===================================================================================================
 Package                    Architecture         Version                  Repository          Size
===================================================================================================
Upgrading:
 epel-release               noarch               8-13.el8                 epel                23 k
Transaction Summary
===================================================================================================
Upgrade  1 Package
Total download size: 23 k
Is this ok [y/N]: y
Downloading Packages:
epel-release-8-13.el8.noarch.rpm                                   363 kB/s |  23 kB     00:00    
---------------------------------------------------------------------------------------------------
Total                                                               39 kB/s |  23 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1 
  Running scriptlet: epel-release-8-13.el8.noarch                                              1/1 
  Upgrading        : epel-release-8-13.el8.noarch                                              1/2 
warning: /etc/yum.repos.d/epel-playground.repo created as /etc/yum.repos.d/epel-playground.repo.rpmnew
warning: /etc/yum.repos.d/epel-testing-modular.repo created as /etc/yum.repos.d/epel-testing-modular.repo.rpmnew
warning: /etc/yum.repos.d/epel-testing.repo created as /etc/yum.repos.d/epel-testing.repo.rpmnew
Cleanup          : epel-release-8-11.el8.noarch                                              2/2 
  Running scriptlet: epel-release-8-11.el8.noarch                                              2/2 
  Verifying        : epel-release-8-13.el8.noarch                                              1/2 
  Verifying        : epel-release-8-11.el8.noarch                                              2/2
Upgraded:
  epel-release-8-13.el8.noarch
Complete!
# yum install ansible
Last metadata expiration check: 0:01:12 ago on Mon 18 Oct 2021 01:41:22 PM UTC.
Dependencies resolved.
===================================================================================================
 Package                       Architecture    Version                    Repository          Size
===================================================================================================
Installing:
 ansible                       noarch          2.9.25-1.el8               epel                17 M
Installing dependencies:
 libsodium                     x86_64          1.0.18-2.el8               epel               162 k
 python3-babel                 noarch          2.5.1-5.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-4.el8                baseos             559 k
 python3-jinja2                noarch          2.10.1-2.el8_0             appstream          538 k
 python3-jmespath              noarch          0.9.0-11.el8               appstream           45 k
 python3-markupsafe            x86_64          0.23-19.el8                appstream           39 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-pyyaml                x86_64          3.12-12.el8                baseos             193 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
Transaction Summary
===================================================================================================
Install  16 Packages
Total download size: 24 M
Installed size: 127 M
Is this ok [y/N]: y
Downloading Packages:
(1/16): python3-jmespath-0.9.0-11.el8.noarch.rpm                   314 kB/s |  45 kB     00:00    
(2/16): python3-markupsafe-0.23-19.el8.x86_64.rpm                  267 kB/s |  39 kB     00:00    
(3/16): python3-jinja2-2.10.1-2.el8_0.noarch.rpm                   1.6 MB/s | 538 kB     00:00    
(4/16): python3-pyasn1-0.3.7-6.el8.noarch.rpm                      1.5 MB/s | 126 kB     00:00    
(5/16): python3-pytz-2017.2-9.el8.noarch.rpm                       1.2 MB/s |  54 kB     00:00    
(6/16): python3-cffi-1.11.5-5.el8.x86_64.rpm                       1.0 MB/s | 237 kB     00:00    
(7/16): python3-pycparser-2.14-14.el8.noarch.rpm                   1.5 MB/s | 109 kB     00:00    
(8/16): python3-pyyaml-3.12-12.el8.x86_64.rpm                      1.7 MB/s | 193 kB     00:00    
(9/16): python3-cryptography-3.2.1-4.el8.x86_64.rpm                990 kB/s | 559 kB     00:00    
(10/16): libsodium-1.0.18-2.el8.x86_64.rpm                         1.1 MB/s | 162 kB     00:00    
(11/16): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm                   995 kB/s |  44 kB     00:00    
(12/16): python3-paramiko-2.4.3-1.el8.noarch.rpm                   1.7 MB/s | 289 kB     00:00    
(13/16): python3-pynacl-1.3.0-5.el8.x86_64.rpm                     1.1 MB/s | 100 kB     00:00    
(14/16): sshpass-1.06-9.el8.x86_64.rpm                             1.0 MB/s |  27 kB     00:00    
(15/16): python3-babel-2.5.1-5.el8.noarch.rpm                      2.4 MB/s | 4.8 MB     00:02    
(16/16): ansible-2.9.25-1.el8.noarch.rpm                           4.7 MB/s |  17 MB     00:03    
---------------------------------------------------------------------------------------------------
Total                                                              4.9 MB/s |  24 MB     00:04     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1 
  Installing       : sshpass-1.06-9.el8.x86_64                                                1/16 
  Installing       : libsodium-1.0.18-2.el8.x86_64                                            2/16 
  Installing       : python3-pyyaml-3.12-12.el8.x86_64                                        3/16 
  Installing       : python3-pycparser-2.14-14.el8.noarch                                     4/16 
  Installing       : python3-cffi-1.11.5-5.el8.x86_64                                         5/16 
  Installing       : python3-cryptography-3.2.1-4.el8.x86_64                                  6/16 
  Installing       : python3-bcrypt-3.1.6-2.el8.1.x86_64                                      7/16 
  Installing       : python3-pynacl-1.3.0-5.el8.x86_64                                        8/16 
  Installing       : python3-pytz-2017.2-9.el8.noarch                                         9/16 
  Installing       : python3-babel-2.5.1-5.el8.noarch                                        10/16 
  Installing       : python3-pyasn1-0.3.7-6.el8.noarch                                       11/16 
  Installing       : python3-paramiko-2.4.3-1.el8.noarch                                     12/16 
  Installing       : python3-markupsafe-0.23-19.el8.x86_64                                   13/16 
  Installing       : python3-jinja2-2.10.1-2.el8_0.noarch                                    14/16 
  Installing       : python3-jmespath-0.9.0-11.el8.noarch                                    15/16 
  Installing       : ansible-2.9.25-1.el8.noarch                                             16/16 
  Running scriptlet: ansible-2.9.25-1.el8.noarch                                             16/16 
  Verifying        : python3-babel-2.5.1-5.el8.noarch                                         1/16 
  Verifying        : python3-jinja2-2.10.1-2.el8_0.noarch                                     2/16 
  Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                     3/16 
  Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                    4/16 
  Verifying        : python3-pyasn1-0.3.7-6.el8.noarch                                        5/16 
  Verifying        : python3-pytz-2017.2-9.el8.noarch                                         6/16 
  Verifying        : python3-cffi-1.11.5-5.el8.x86_64                                         7/16 
  Verifying        : python3-cryptography-3.2.1-4.el8.x86_64                                  8/16 
  Verifying        : python3-pycparser-2.14-14.el8.noarch                                     9/16 
  Verifying        : python3-pyyaml-3.12-12.el8.x86_64                                       10/16 
  Verifying        : ansible-2.9.25-1.el8.noarch                                             11/16 
  Verifying        : libsodium-1.0.18-2.el8.x86_64                                           12/16 
  Verifying        : python3-bcrypt-3.1.6-2.el8.1.x86_64                                     13/16 
  Verifying        : python3-paramiko-2.4.3-1.el8.noarch                                     14/16 
  Verifying        : python3-pynacl-1.3.0-5.el8.x86_64                                       15/16 
  Verifying        : sshpass-1.06-9.el8.x86_64                                               16/16
Installed:
  ansible-2.9.25-1.el8.noarch                     libsodium-1.0.18-2.el8.x86_64                    
  python3-babel-2.5.1-5.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-4.el8.x86_64          
  python3-jinja2-2.10.1-2.el8_0.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-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-pyyaml-3.12-12.el8.x86_64               sshpass-1.06-9.el8.x86_64
Complete!
# ansible --version
ansible 2.9.25
  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 = /usr/bin/ansible
  python version = 3.6.8 (default, Mar 19 2021, 05:13:41) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]

code with ❤️ in GitHub

Recap

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