Ansible Pilot

How to install Ansible in RedHat Enterprise Linux (RHEL) 9.2 - Ansible install

How to install Ansible Core (ansible-core) in RedHat Enterprise Linux 9.2 included in the RHEL 9.2 AppStream repository.

June 29, 2023
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

How to install Ansible in Red Hat Enterprise Linux version 9.2?

Today we’re going to talk about the easier way to install and maintain up-to-date Ansible inside RHEL 9.2 with the distribution tools. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

How to install Ansible in RHEL 9.2

Today we’re talking about How to install Ansible in RHEL 9.2. The good news is that the Ansible Core package (ansible-core) is included out-of-the-box in the RHEL 9.2 AppStream repository. No more additional repository (Ansible Engine or EPEL) like previous versions for basic automation. However, for additional support for the underlying platform and Core-maintained modules is required the Ansible Automation Platform subscription.

See also: Ansible terminology - ansible vs ansible-core packages.

The Best Resources For Ansible

Certifications

Video Course

Printed Book

eBooks

demo

Install latest Ansible-Core in RHEL 9.2.

code

#!/bin/bash
sudo dnf install ansible-core

execution

[root@localhost luca]# dnf install ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:28:25 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Dependencies resolved.
=========================================================================================
 Package                Arch    Version          Repository                         Size
=========================================================================================
Installing:
 ansible-core           aarch64 2.14.2-5.el9_2   rhel-9-for-aarch64-appstream-rpms 3.4 M
Installing dependencies:
 git-core               aarch64 2.39.3-1.el9_2   rhel-9-for-aarch64-appstream-rpms 4.4 M
 libnsl2                aarch64 2.0.0-1.el9      rhel-9-for-aarch64-appstream-rpms  32 k
 mpdecimal              aarch64 2.5.1-3.el9      rhel-9-for-aarch64-appstream-rpms  90 k
 python3.11             aarch64 3.11.2-2.el9_2.1 rhel-9-for-aarch64-appstream-rpms  28 k
 python3.11-cffi        aarch64 1.15.1-1.el9     rhel-9-for-aarch64-appstream-rpms 319 k
 python3.11-cryptography
                        aarch64 37.0.2-5.el9     rhel-9-for-aarch64-appstream-rpms 1.2 M
 python3.11-libs        aarch64 3.11.2-2.el9_2.1 rhel-9-for-aarch64-appstream-rpms 9.8 M
 python3.11-ply         noarch  3.11-1.el9       rhel-9-for-aarch64-appstream-rpms 141 k
 python3.11-pycparser   noarch  2.20-1.el9       rhel-9-for-aarch64-appstream-rpms 161 k
 python3.11-pyyaml      aarch64 6.0-1.el9        rhel-9-for-aarch64-appstream-rpms 224 k
 python3.11-six         noarch  1.16.0-1.el9     rhel-9-for-aarch64-appstream-rpms  47 k
 sshpass                aarch64 1.09-4.el9       rhel-9-for-aarch64-appstream-rpms  30 k

Transaction Summary
=========================================================================================
Install  13 Packages

Total download size: 20 M
Installed size: 88 M
Is this ok [y/N]: y
Downloading Packages:
(1/13): libnsl2-2.0.0-1.el9.aarch64.rpm                  114 kB/s |  32 kB     00:00    
(2/13): sshpass-1.09-4.el9.aarch64.rpm                    91 kB/s |  30 kB     00:00    
(3/13): python3.11-six-1.16.0-1.el9.noarch.rpm           314 kB/s |  47 kB     00:00    
(4/13): python3.11-cryptography-37.0.2-5.el9.aarch64.rpm 1.9 MB/s | 1.2 MB     00:00    
(5/13): python3.11-pycparser-2.20-1.el9.noarch.rpm       572 kB/s | 161 kB     00:00    
(6/13): python3.11-pyyaml-6.0-1.el9.aarch64.rpm          454 kB/s | 224 kB     00:00    
(7/13): mpdecimal-2.5.1-3.el9.aarch64.rpm                416 kB/s |  90 kB     00:00    
(8/13): python3.11-cffi-1.15.1-1.el9.aarch64.rpm         1.8 MB/s | 319 kB     00:00    
(9/13): python3.11-ply-3.11-1.el9.noarch.rpm             604 kB/s | 141 kB     00:00    
(10/13): python3.11-3.11.2-2.el9_2.1.aarch64.rpm         184 kB/s |  28 kB     00:00    
(11/13): git-core-2.39.3-1.el9_2.aarch64.rpm             4.1 MB/s | 4.4 MB     00:01    
(12/13): ansible-core-2.14.2-5.el9_2.aarch64.rpm         3.3 MB/s | 3.4 MB     00:01    
(13/13): python3.11-libs-3.11.2-2.el9_2.1.aarch64.rpm    4.9 MB/s | 9.8 MB     00:02    
-----------------------------------------------------------------------------------------
Total                                                    6.8 MB/s |  20 MB     00:02     
Red Hat Enterprise Linux 9 for ARM 64 - AppStream (RPMs) 3.5 MB/s | 3.6 kB     00:00    
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) <[email protected]>"
 Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0x5A6340B3:
 Userid     : "Red Hat, Inc. (auxiliary key 3) <[email protected]>"
 Fingerprint: 7E46 2425 8C40 6535 D56D 6F13 5054 E4A4 5A63 40B3
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
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       : git-core-2.39.3-1.el9_2.aarch64                                1/13 
  Installing       : mpdecimal-2.5.1-3.el9.aarch64                                  2/13 
  Installing       : libnsl2-2.0.0-1.el9.aarch64                                    3/13 
  Installing       : python3.11-3.11.2-2.el9_2.1.aarch64                            4/13 
  Installing       : python3.11-libs-3.11.2-2.el9_2.1.aarch64                       5/13 
  Installing       : python3.11-pyyaml-6.0-1.el9.aarch64                            6/13 
  Installing       : python3.11-six-1.16.0-1.el9.noarch                             7/13 
  Installing       : python3.11-ply-3.11-1.el9.noarch                               8/13 
  Installing       : python3.11-pycparser-2.20-1.el9.noarch                         9/13 
  Installing       : python3.11-cffi-1.15.1-1.el9.aarch64                          10/13 
  Installing       : python3.11-cryptography-37.0.2-5.el9.aarch64                  11/13 
  Installing       : sshpass-1.09-4.el9.aarch64                                    12/13 
  Installing       : ansible-core-2.14.2-5.el9_2.aarch64                           13/13 
  Running scriptlet: ansible-core-2.14.2-5.el9_2.aarch64                           13/13 
  Verifying        : sshpass-1.09-4.el9.aarch64                                     1/13 
  Verifying        : libnsl2-2.0.0-1.el9.aarch64                                    2/13 
  Verifying        : python3.11-cryptography-37.0.2-5.el9.aarch64                   3/13 
  Verifying        : python3.11-pyyaml-6.0-1.el9.aarch64                            4/13 
  Verifying        : python3.11-six-1.16.0-1.el9.noarch                             5/13 
  Verifying        : python3.11-pycparser-2.20-1.el9.noarch                         6/13 
  Verifying        : mpdecimal-2.5.1-3.el9.aarch64                                  7/13 
  Verifying        : python3.11-cffi-1.15.1-1.el9.aarch64                           8/13 
  Verifying        : python3.11-ply-3.11-1.el9.noarch                               9/13 
  Verifying        : git-core-2.39.3-1.el9_2.aarch64                               10/13 
  Verifying        : python3.11-libs-3.11.2-2.el9_2.1.aarch64                      11/13 
  Verifying        : python3.11-3.11.2-2.el9_2.1.aarch64                           12/13 
  Verifying        : ansible-core-2.14.2-5.el9_2.aarch64                           13/13 
Installed products updated.

Installed:
  ansible-core-2.14.2-5.el9_2.aarch64           git-core-2.39.3-1.el9_2.aarch64          
  libnsl2-2.0.0-1.el9.aarch64                   mpdecimal-2.5.1-3.el9.aarch64            
  python3.11-3.11.2-2.el9_2.1.aarch64           python3.11-cffi-1.15.1-1.el9.aarch64     
  python3.11-cryptography-37.0.2-5.el9.aarch64  python3.11-libs-3.11.2-2.el9_2.1.aarch64 
  python3.11-ply-3.11-1.el9.noarch              python3.11-pycparser-2.20-1.el9.noarch   
  python3.11-pyyaml-6.0-1.el9.aarch64           python3.11-six-1.16.0-1.el9.noarch       
  sshpass-1.09-4.el9.aarch64                   

Complete!
[root@localhost luca]# dnf list ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:29:01 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Installed Packages
ansible-core.aarch64          2.14.2-5.el9_2           @rhel-9-for-aarch64-appstream-rpms
[root@localhost luca]# ansible --version
ansible [core 2.14.2]
  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.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /bin/ansible
  python version = 3.11.2 (main, May 24 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
[root@localhost luca]#

before execution

[root@localhost luca]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.2 (Plow)
[root@localhost luca]# cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="9.2 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.2 (Plow)"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:redhat:enterprise_linux:9::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_BUGZILLA_PRODUCT_VERSION=9.2
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
[root@localhost luca]# dnf search ansible
Updating Subscription Management repositories.
Last metadata expiration check: 0:27:07 ago on Thu 29 Jun 2023 02:55:29 PM BST.
============================ Name & Summary Matched: ansible ============================
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-freeipa-tests.noarch : ansible-freeipa tests
ansible-pcp.noarch : Ansible Metric collection for Performance Co-Pilot
ansible-test.aarch64 : Tool for testing ansible plugin and module code
================================= Name Matched: ansible =================================
ansible-core.aarch64 : SSH-based configuration management, deployment, and task execution
                     : system
ansible-freeipa.noarch : Roles and playbooks to deploy FreeIPA servers, replicas and
                       : clients
[root@localhost luca]# dnf list ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:27:26 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Available Packages
ansible-core.aarch64           2.14.2-5.el9_2           rhel-9-for-aarch64-appstream-rpms
[root@localhost luca]# dnf list ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:27:39 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Available Packages
ansible-core.aarch64           2.14.2-5.el9_2           rhel-9-for-aarch64-appstream-rpms
[root@localhost luca]# dnf info ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:27:45 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Available Packages
Name         : ansible-core
Version      : 2.14.2
Release      : 5.el9_2
Architecture : aarch64
Size         : 3.4 M
Source       : ansible-core-2.14.2-5.el9_2.src.rpm
Repository   : rhel-9-for-aarch64-appstream-rpms
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@localhost luca]# ansible --version
bash: ansible: command not found...
Install package 'ansible-core' to provide command 'ansible'? [N/y] n


[root@localhost luca]#

after execution

[root@localhost luca]# dnf list ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:29:01 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Installed Packages
ansible-core.aarch64          2.14.2-5.el9_2           @rhel-9-for-aarch64-appstream-rpms
[root@localhost luca]# dnf info ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:29:18 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Installed Packages
Name         : ansible-core
Version      : 2.14.2
Release      : 5.el9_2
Architecture : aarch64
Size         : 14 M
Source       : ansible-core-2.14.2-5.el9_2.src.rpm
Repository   : @System
From repo    : rhel-9-for-aarch64-appstream-rpms
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@localhost luca]# ansible --version
ansible [core 2.14.2]
  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.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /bin/ansible
  python version = 3.11.2 (main, May 24 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
[root@localhost luca]# dnf update ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 0:32:05 ago on Thu 29 Jun 2023 02:55:29 PM BST.
Dependencies resolved.
Nothing to do.
Complete!
[root@localhost luca]#

Recap

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