Ansible Pilot

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

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

November 22, 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.3?

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

How to install Ansible in RHEL 9.3

Today we’re talking about How to install Ansible in RHEL 9.3. The good news is that the Ansible Core package (ansible-core) is included out-of-the-box in the RHEL 9.3 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.3.

code

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

execution

[root@localhost devops]# dnf install ansible
Updating Subscription Management repositories.
Last metadata expiration check: 4:37:26 ago on Wed 22 Nov 2023 04:06:02 AM PST.
No match for argument: ansible
Error: Unable to find a match: ansible
[root@localhost devops]# dnf install ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 4:37:35 ago on Wed 22 Nov 2023 04:06:02 AM PST.
Dependencies resolved.
=========================================================================================
 Package               Arch     Version         Repository                          Size
=========================================================================================
Installing:
 ansible-core          aarch64  1:2.14.9-1.el9  rhel-9-for-aarch64-appstream-rpms  2.6 M
Installing dependencies:
 git-core              aarch64  2.39.3-1.el9_2  rhel-9-for-aarch64-appstream-rpms  4.4 M
 python3-cffi          aarch64  1.14.5-5.el9    rhel-9-for-aarch64-baseos-rpms     261 k
 python3-cryptography  aarch64  36.0.1-4.el9    rhel-9-for-aarch64-baseos-rpms     1.2 M
 python3-packaging     noarch   20.9-5.el9      rhel-9-for-aarch64-appstream-rpms   81 k
 python3-ply           noarch   3.11-14.el9     rhel-9-for-aarch64-baseos-rpms     111 k
 python3-pycparser     noarch   2.20-6.el9      rhel-9-for-aarch64-baseos-rpms     139 k
 python3-pyparsing     noarch   2.4.7-9.el9     rhel-9-for-aarch64-baseos-rpms     154 k
 python3-resolvelib    noarch   0.5.4-5.el9     rhel-9-for-aarch64-appstream-rpms   38 k
 sshpass               aarch64  1.09-4.el9      rhel-9-for-aarch64-appstream-rpms   30 k

Transaction Summary
=========================================================================================
Install  10 Packages

Total download size: 9.0 M
Installed size: 37 M
Is this ok [y/N]: y
Downloading Packages:
(1/10): python3-cffi-1.14.5-5.el9.aarch64.rpm            210 kB/s | 261 kB     00:01    
(2/10): python3-pyparsing-2.4.7-9.el9.noarch.rpm          72 kB/s | 154 kB     00:02    
(3/10): python3-ply-3.11-14.el9.noarch.rpm                42 kB/s | 111 kB     00:02    
(4/10): python3-pycparser-2.20-6.el9.noarch.rpm           75 kB/s | 139 kB     00:01    
(5/10): python3-packaging-20.9-5.el9.noarch.rpm           87 kB/s |  81 kB     00:00    
(6/10): python3-resolvelib-0.5.4-5.el9.noarch.rpm         32 kB/s |  38 kB     00:01    
(7/10): python3-cryptography-36.0.1-4.el9.aarch64.rpm    428 kB/s | 1.2 MB     00:02    
(8/10): sshpass-1.09-4.el9.aarch64.rpm                    11 kB/s |  30 kB     00:02    
(9/10): ansible-core-2.14.9-1.el9.aarch64.rpm            2.0 MB/s | 2.6 MB     00:01    
(10/10): git-core-2.39.3-1.el9_2.aarch64.rpm             1.8 MB/s | 4.4 MB     00:02    
-----------------------------------------------------------------------------------------
Total                                                    1.3 MB/s | 9.0 MB     00:06     
Red Hat Enterprise Linux 9 for ARM 64 - BaseOS (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/10 
  Installing       : sshpass-1.09-4.el9.aarch64                                     2/10 
  Installing       : python3-resolvelib-0.5.4-5.el9.noarch                          3/10 
  Installing       : python3-ply-3.11-14.el9.noarch                                 4/10 
  Installing       : python3-pycparser-2.20-6.el9.noarch                            5/10 
  Installing       : python3-cffi-1.14.5-5.el9.aarch64                              6/10 
  Installing       : python3-cryptography-36.0.1-4.el9.aarch64                      7/10 
  Installing       : python3-pyparsing-2.4.7-9.el9.noarch                           8/10 
  Installing       : python3-packaging-20.9-5.el9.noarch                            9/10 
  Installing       : ansible-core-1:2.14.9-1.el9.aarch64                           10/10 
  Running scriptlet: ansible-core-1:2.14.9-1.el9.aarch64                           10/10 
  Verifying        : python3-pyparsing-2.4.7-9.el9.noarch                           1/10 
  Verifying        : python3-cffi-1.14.5-5.el9.aarch64                              2/10 
  Verifying        : python3-ply-3.11-14.el9.noarch                                 3/10 
  Verifying        : python3-pycparser-2.20-6.el9.noarch                            4/10 
  Verifying        : python3-cryptography-36.0.1-4.el9.aarch64                      5/10 
  Verifying        : python3-packaging-20.9-5.el9.noarch                            6/10 
  Verifying        : python3-resolvelib-0.5.4-5.el9.noarch                          7/10 
  Verifying        : sshpass-1.09-4.el9.aarch64                                     8/10 
  Verifying        : git-core-2.39.3-1.el9_2.aarch64                                9/10 
  Verifying        : ansible-core-1:2.14.9-1.el9.aarch64                           10/10 
Installed products updated.

Installed:
  ansible-core-1:2.14.9-1.el9.aarch64       git-core-2.39.3-1.el9_2.aarch64              
  python3-cffi-1.14.5-5.el9.aarch64         python3-cryptography-36.0.1-4.el9.aarch64    
  python3-packaging-20.9-5.el9.noarch       python3-ply-3.11-14.el9.noarch               
  python3-pycparser-2.20-6.el9.noarch       python3-pyparsing-2.4.7-9.el9.noarch         
  python3-resolvelib-0.5.4-5.el9.noarch     sshpass-1.09-4.el9.aarch64                   

Complete!

Before execution


[root@localhost devops]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.3 (Plow)
[root@localhost devops]# cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="9.3 (Plow)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="9.3"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Red Hat Enterprise Linux 9.3 (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.3
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.3"
[root@localhost devops]# ansible --version
bash: ansible: command not found...
Install package 'ansible-core' to provide command 'ansible'? [N/y] n


[root@localhost devops]# dnf search ansible
Updating Subscription Management repositories.
Last metadata expiration check: 4:36:31 ago on Wed 22 Nov 2023 04:06:02 AM PST.
============================ 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
=============================== Summary Matched: ansible ================================
rhc-worker-playbook.aarch64 : Python worker for Red Hat connector that launches Ansible
                            : Runner
[root@localhost devops]# dnf list ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 4:36:46 ago on Wed 22 Nov 2023 04:06:02 AM PST.
Available Packages
ansible-core.aarch64           1:2.14.9-1.el9           rhel-9-for-aarch64-appstream-rpms
[root@localhost devops]# dnf list ansible
Updating Subscription Management repositories.
Last metadata expiration check: 4:36:50 ago on Wed 22 Nov 2023 04:06:02 AM PST.
Error: No matching Packages to list
[root@localhost devops]# dnf info ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 4:37:07 ago on Wed 22 Nov 2023 04:06:02 AM PST.
Available Packages
Name         : ansible-core
Epoch        : 1
Version      : 2.14.9
Release      : 1.el9
Architecture : aarch64
Size         : 2.6 M
Source       : ansible-core-2.14.9-1.el9.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 devops]# ansible --version
bash: ansible: command not found...
Install package 'ansible-core' to provide command 'ansible'? [N/y] n

After execution

[root@localhost devops]# ansible --version
ansible [core 2.14.9]
  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.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /bin/ansible
  python version = 3.9.18 (main, Sep  7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
[root@localhost devops]# dnf list ansible-core
Updating Subscription Management repositories.
Last metadata expiration check: 4:38:25 ago on Wed 22 Nov 2023 04:06:02 AM PST.
Installed Packages
ansible-core.aarch64          1:2.14.9-1.el9           @rhel-9-for-aarch64-appstream-rpms
[root@localhost devops]#

Recap

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