Ansible Pilot

How to install Ansible in AlmaLinux 9 - Ansible install

How to install and maintain up-to-date Ansible inside AlmaLinux 9 using DNF and the ”appstream” system repository.

July 12, 2022
Access the Complete Video Course and Learn Quick Ansible by 200+ Practical Lessons

How to install Ansible in AlmaLinux version 9.

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

How to install Ansible in AlmaLinux 9

Today we’re talking about How to install Ansible in AlmaLinux 9.

The easier way to install and maintain up-to-date Ansible inside AlmaLinux version 9 is using the ansible-core package included in the AppStream distribution repository. Please notice that the package ansible isn’t available anymore. It’s not necessary to use the additional EPEL package repository.

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

The Best Resources For Ansible

Video Course

Printed Book

eBooks

demo

Let’s jump into a quick live demo of how to install the latest version of Ansible in AlmaLinux. I’m going to install the ansible-core package in an AlmaLinux 9 using the AppStream distribution repository.

code

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

execution

$ ssh [email protected]
[devops@almalinux ~]$ sudo su
[root@almalinux devops]# cat /etc/redhat-release 
AlmaLinux release 9.0 (Emerald Puma)
[root@almalinux devops]# cat /etc/os-release 
NAME="AlmaLinux"
VERSION="9.0 (Emerald Puma)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.0"
PLATFORM_ID="platform:el9"
PRETTY_NAME="AlmaLinux 9.0 (Emerald Puma)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:9::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"
ALMALINUX_MANTISBT_PROJECT="AlmaLinux-9"
ALMALINUX_MANTISBT_PROJECT_VERSION="9.0"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.0"
[root@almalinux devops]# hostnamectl
 Static hostname: almalinux.example.com
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 4a8ab0349b874d1b8294222deebd0f8e
         Boot ID: 3616b69bcbf8433d8d4e9eaa826dee67
  Virtualization: oracle
Operating System: AlmaLinux 9.0 (Emerald Puma)        
     CPE OS Name: cpe:/o:almalinux:almalinux:9::baseos
          Kernel: Linux 5.14.0-70.13.1.el9_0.x86_64
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
[root@almalinux devops]# uname -a
Linux almalinux.example.com 5.14.0-70.13.1.el9_0.x86_64 #1 SMP PREEMPT Tue May 17 15:53:11 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@almalinux devops]# dnf search ansible
Last metadata expiration check: 16:31:06 ago on Mon Jul 11 14:56:03 2022.
============================================================================== 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.x86_64 : Tool for testing ansible plugin and module code
=================================================================================== Name Matched: ansible ===================================================================================
ansible-core.x86_64 : SSH-based configuration management, deployment, and task execution system
ansible-freeipa.noarch : Roles and playbooks to deploy FreeIPA servers, replicas and clients
[root@almalinux devops]# dnf info ansible-core
Last metadata expiration check: 16:31:14 ago on Mon Jul 11 14:56:03 2022.
Available Packages
Name         : ansible-core
Version      : 2.12.2
Release      : 1.el9
Architecture : x86_64
Size         : 2.0 M
Source       : ansible-core-2.12.2-1.el9.src.rpm
Repository   : appstream
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-core
Last metadata expiration check: 16:58:16 ago on Mon Jul 11 14:56:03 2022.
Dependencies resolved.
===================================================================================================
 Package                       Architecture    Version                    Repository          Size
===================================================================================================
Installing:
 ansible-core                  x86_64          2.12.2-1.el9               appstream          2.0 M
Installing dependencies:
 emacs-filesystem              noarch          1:27.2-6.el9               appstream          8.4 k
 git                           x86_64          2.31.1-2.el9.2             appstream          120 k
 git-core                      x86_64          2.31.1-2.el9.2             appstream          3.6 M
 git-core-doc                  noarch          2.31.1-2.el9.2             appstream          2.3 M
 perl-Error                    noarch          1:0.17029-7.el9            appstream           41 k
 perl-Git                      noarch          2.31.1-2.el9.2             appstream           42 k
 python3-babel                 noarch          2.9.1-2.el9                appstream          5.8 M
 python3-cffi                  x86_64          1.14.5-5.el9               appstream          241 k
 python3-cryptography          x86_64          36.0.1-1.el9_0             appstream          1.1 M
 python3-jinja2                noarch          2.11.3-4.el9               appstream          229 k
 python3-markupsafe            x86_64          1.1.1-12.el9               appstream           32 k
 python3-packaging             noarch          20.9-5.el9                 appstream           69 k
 python3-ply                   noarch          3.11-14.el9                appstream          103 k
 python3-pycparser             noarch          2.20-6.el9                 appstream          124 k
 python3-pytz                  noarch          2021.1-4.el9               appstream           48 k
 python3-resolvelib            noarch          0.5.4-5.el9                appstream           29 k
 python3-setuptools            noarch          53.0.0-10.el9              baseos             841 k
 sshpass                       x86_64          1.09-4.el9                 appstream           27 k
Transaction Summary
===================================================================================================
Install  19 Packages
Total download size: 17 M
Installed size: 80 M
Is this ok [y/N]: y
Downloading Packages:
(1/19): emacs-filesystem-27.2-6.el9.noarch.rpm                     428  B/s | 8.4 kB     00:20    
(2/19): git-2.31.1-2.el9.2.x86_64.rpm                              6.0 kB/s | 120 kB     00:20    
[MIRROR] git-core-2.31.1-2.el9.2.x86_64.rpm: Curl error (28): Timeout was reached for http://it2.mirror.vhosting-it.com/almalinux/9/AppStream/x86_64/os/Packages/git-core-2.31.1-2.el9.2.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[MIRROR] git-core-doc-2.31.1-2.el9.2.noarch.rpm: Curl error (28): Timeout was reached for http://it2.mirror.vhosting-it.com/almalinux/9/AppStream/x86_64/os/Packages/git-core-doc-2.31.1-2.el9.2.noarch.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
[MIRROR] ansible-core-2.12.2-1.el9.x86_64.rpm: Curl error (28): Timeout was reached for http://it2.mirror.vhosting-it.com/almalinux/9/AppStream/x86_64/os/Packages/ansible-core-2.12.2-1.el9.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
(3/19): ansible-core-2.12.2-1.el9.x86_64.rpm                        35 kB/s | 2.0 MB     00:58    
(4/19): perl-Error-0.17029-7.el9.noarch.rpm                        234 kB/s |  41 kB     00:00    
(5/19): git-core-doc-2.31.1-2.el9.2.noarch.rpm                      58 kB/s | 2.3 MB     00:40    
(6/19): perl-Git-2.31.1-2.el9.2.noarch.rpm                          23 kB/s |  42 kB     00:01    
(7/19): git-core-2.31.1-2.el9.2.x86_64.rpm                          91 kB/s | 3.6 MB     00:40    
(8/19): python3-cffi-1.14.5-5.el9.x86_64.rpm                       408 kB/s | 241 kB     00:00    
(9/19): python3-cryptography-36.0.1-1.el9_0.x86_64.rpm             1.8 MB/s | 1.1 MB     00:00    
(10/19): python3-markupsafe-1.1.1-12.el9.x86_64.rpm                225 kB/s |  32 kB     00:00    
(11/19): python3-jinja2-2.11.3-4.el9.noarch.rpm                    775 kB/s | 229 kB     00:00    
(12/19): python3-packaging-20.9-5.el9.noarch.rpm                   595 kB/s |  69 kB     00:00    
(13/19): python3-ply-3.11-14.el9.noarch.rpm                        598 kB/s | 103 kB     00:00    
(14/19): python3-pycparser-2.20-6.el9.noarch.rpm                   706 kB/s | 124 kB     00:00    
(15/19): python3-pytz-2021.1-4.el9.noarch.rpm                      270 kB/s |  48 kB     00:00    
(16/19): python3-resolvelib-0.5.4-5.el9.noarch.rpm                 207 kB/s |  29 kB     00:00    
(17/19): sshpass-1.09-4.el9.x86_64.rpm                             154 kB/s |  27 kB     00:00    
(18/19): python3-babel-2.9.1-2.el9.noarch.rpm                      2.1 MB/s | 5.8 MB     00:02    
(19/19): python3-setuptools-53.0.0-10.el9.noarch.rpm               161 kB/s | 841 kB     00:05    
---------------------------------------------------------------------------------------------------
Total                                                              249 kB/s |  17 MB     01:08     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1 
  Installing       : python3-setuptools-53.0.0-10.el9.noarch                                  1/19 
  Installing       : git-core-2.31.1-2.el9.2.x86_64                                           2/19 
  Installing       : git-core-doc-2.31.1-2.el9.2.noarch                                       3/19 
  Installing       : sshpass-1.09-4.el9.x86_64                                                4/19 
  Installing       : python3-resolvelib-0.5.4-5.el9.noarch                                    5/19 
  Installing       : python3-pytz-2021.1-4.el9.noarch                                         6/19 
  Installing       : python3-babel-2.9.1-2.el9.noarch                                         7/19 
  Installing       : python3-ply-3.11-14.el9.noarch                                           8/19 
  Installing       : python3-pycparser-2.20-6.el9.noarch                                      9/19 
  Installing       : python3-cffi-1.14.5-5.el9.x86_64                                        10/19 
  Installing       : python3-cryptography-36.0.1-1.el9_0.x86_64                              11/19 
  Installing       : python3-packaging-20.9-5.el9.noarch                                     12/19 
  Installing       : python3-markupsafe-1.1.1-12.el9.x86_64                                  13/19 
  Installing       : python3-jinja2-2.11.3-4.el9.noarch                                      14/19 
  Installing       : perl-Error-1:0.17029-7.el9.noarch                                       15/19 
  Installing       : emacs-filesystem-1:27.2-6.el9.noarch                                    16/19 
  Installing       : perl-Git-2.31.1-2.el9.2.noarch                                          17/19 
  Installing       : git-2.31.1-2.el9.2.x86_64                                               18/19 
  Installing       : ansible-core-2.12.2-1.el9.x86_64                                        19/19 
  Running scriptlet: ansible-core-2.12.2-1.el9.x86_64                                        19/19 
  Verifying        : ansible-core-2.12.2-1.el9.x86_64                                         1/19 
  Verifying        : emacs-filesystem-1:27.2-6.el9.noarch                                     2/19 
  Verifying        : git-2.31.1-2.el9.2.x86_64                                                3/19 
  Verifying        : git-core-2.31.1-2.el9.2.x86_64                                           4/19 
  Verifying        : git-core-doc-2.31.1-2.el9.2.noarch                                       5/19 
  Verifying        : perl-Error-1:0.17029-7.el9.noarch                                        6/19 
  Verifying        : perl-Git-2.31.1-2.el9.2.noarch                                           7/19 
  Verifying        : python3-babel-2.9.1-2.el9.noarch                                         8/19 
  Verifying        : python3-cffi-1.14.5-5.el9.x86_64                                         9/19 
  Verifying        : python3-cryptography-36.0.1-1.el9_0.x86_64                              10/19 
  Verifying        : python3-jinja2-2.11.3-4.el9.noarch                                      11/19 
  Verifying        : python3-markupsafe-1.1.1-12.el9.x86_64                                  12/19 
  Verifying        : python3-packaging-20.9-5.el9.noarch                                     13/19 
  Verifying        : python3-ply-3.11-14.el9.noarch                                          14/19 
  Verifying        : python3-pycparser-2.20-6.el9.noarch                                     15/19 
  Verifying        : python3-pytz-2021.1-4.el9.noarch                                        16/19 
  Verifying        : python3-resolvelib-0.5.4-5.el9.noarch                                   17/19 
  Verifying        : sshpass-1.09-4.el9.x86_64                                               18/19 
  Verifying        : python3-setuptools-53.0.0-10.el9.noarch                                 19/19
Installed:
  ansible-core-2.12.2-1.el9.x86_64              emacs-filesystem-1:27.2-6.el9.noarch              
  git-2.31.1-2.el9.2.x86_64                     git-core-2.31.1-2.el9.2.x86_64                    
  git-core-doc-2.31.1-2.el9.2.noarch            perl-Error-1:0.17029-7.el9.noarch                 
  perl-Git-2.31.1-2.el9.2.noarch                python3-babel-2.9.1-2.el9.noarch                  
  python3-cffi-1.14.5-5.el9.x86_64              python3-cryptography-36.0.1-1.el9_0.x86_64        
  python3-jinja2-2.11.3-4.el9.noarch            python3-markupsafe-1.1.1-12.el9.x86_64            
  python3-packaging-20.9-5.el9.noarch           python3-ply-3.11-14.el9.noarch                    
  python3-pycparser-2.20-6.el9.noarch           python3-pytz-2021.1-4.el9.noarch                  
  python3-resolvelib-0.5.4-5.el9.noarch         python3-setuptools-53.0.0-10.el9.noarch           
  sshpass-1.09-4.el9.x86_64
Complete!
[root@almalinux devops]# ansible --version
ansible [core 2.12.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.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /bin/ansible
  python version = 3.9.10 (main, Feb  9 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
  jinja version = 2.11.3
  libyaml = True

before execution

# dnf info ansible-core
Last metadata expiration check: 16:31:14 ago on Mon Jul 11 14:56:03 2022.
Available Packages
Name         : ansible-core
Version      : 2.12.2
Release      : 1.el9
Architecture : x86_64
Size         : 2.0 M
Source       : ansible-core-2.12.2-1.el9.src.rpm
Repository   : appstream
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-core
Last metadata expiration check: 17:00:09 ago on Mon Jul 11 14:56:03 2022.
Installed Packages
Name         : ansible-core
Version      : 2.12.2
Release      : 1.el9
Architecture : x86_64
Size         : 9.3 M
Source       : ansible-core-2.12.2-1.el9.src.rpm
Repository   : @System
From repo    : appstream
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 AppStream repository. Subscribe to the YouTube channel, Medium, Website, Twitter, and Substack 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