AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,400 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of 8 Ansible books published by Apress and Leanpub including "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example", and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

How to install Ansible in Fedora 36 - Ansible install

By Luca Berton · Published 2024-01-01 · Category: installation

How to install and maintain the latest version of Ansible inside Fedora 36 using the system repository with a practical Playbook.

How to install Ansible in Fedora 36 - Ansible install

How to install Ansible in Fedora version 36. Today we're going to talk about the easier way to install and maintain Ansible inside Fedora 36 using the system repository.

How to install Ansible in Fedora 36

Today we're talking about How to install Ansible in Fedora 36. The good news is that Ansible is included in the default repository so you could install it simply with your usual package manager. You could expect the latest version of Ansible in the updates repository. At the moment is available the latest 2.12 for ansible-core and 5.7 for ansible.

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

## Playbook

Let's jump in a quick live Playbook of how to install the latest version of Ansible in Fedora.

code

  • install-Ansible-Fedora.sh
#!/bin/bash
$ sudo dnf list available ansible
$ sudo dnf install ansible
$ sudo "rpm -qa | grep ansible"
$ sudo dnf list ansible

execution

$ ssh devops@fedora.example.com
[devops@fedora ~]$ sudo su
[root@fedora devops]# cat /etc/redhat-release 
Fedora release 36 (Thirty Six)
[root@fedora devops]# hostnamectl 
 Static hostname: fedora.example.com
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 6a5acc6d28614718b9a00f1b3595bd9a
         Boot ID: 34de0e3a106e4ec78870948a6fdf2018
  Virtualization: oracle
Operating System: Fedora Linux 36 (Cloud Edition) 
     CPE OS Name: cpe:/o:fedoraproject:fedora:36
          Kernel: Linux 5.17.5-300.fc36.x86_64
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
[root@fedora devops]# cat /etc/os-release 
NAME="Fedora Linux"
VERSION="36 (Cloud Edition)"
ID=fedora
VERSION_ID=36
VERSION_CODENAME=""
PLATFORM_ID="platform:f36"
PRETTY_NAME="Fedora Linux 36 (Cloud Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:36"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f36/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=36
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=36
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Cloud Edition"
VARIANT_ID=cloud
[root@fedora devops]# dnf list available ansible
Fedora 36 - x86_64                                                 2.8 MB/s |  81 MB     00:29    
Fedora 36 openh264 (From Cisco) - x86_64                           1.4 kB/s | 2.5 kB     00:01    
Fedora Modular 36 - x86_64                                         822 kB/s | 2.4 MB     00:02    
Fedora 36 - x86_64 - Updates                                       1.9 MB/s |  13 MB     00:07    
Fedora Modular 36 - x86_64 - Updates                               921 kB/s | 2.1 MB     00:02    
Last metadata expiration check: 0:00:01 ago on Mon 16 May 2022 07:48:42 AM UTC.
Available Packages
ansible.noarch                                 5.7.0-1.fc36                                 updates
[root@fedora devops]# dnf list available ansible-core
Last metadata expiration check: 0:00:14 ago on Mon 16 May 2022 07:48:42 AM UTC.
Available Packages
ansible-core.noarch                              2.12.5-1.fc36                              updates
[root@fedora devops]# rpm -qa | grep ansible
[root@fedora devops]# ansible --version
bash: ansible: command not found
[root@fedora devops]# dnf install ansible
Last metadata expiration check: 0:00:48 ago on Mon 16 May 2022 07:48:42 AM UTC.
Dependencies resolved.
===================================================================================================
 Package                         Architecture     Version                  Repository         Size
===================================================================================================
Installing:
 ansible                         noarch           5.7.0-1.fc36             updates            33 M
Installing dependencies:
 ansible-core                    noarch           2.12.5-1.fc36            updates           2.4 M
 libsodium                       x86_64           1.0.18-9.fc36            fedora            163 k
 python3-bcrypt                  x86_64           3.2.2-1.fc36             updates            43 k
 python3-jmespath                noarch           1.0.0-2.fc36             updates            44 k
 python3-ntlm-auth               noarch           1.5.0-4.fc35             fedora             53 k
 python3-packaging               noarch           21.3-2.fc36              fedora             72 k
 python3-pynacl                  x86_64           1.4.0-5.fc36             fedora            108 k
 python3-pyparsing               noarch           2.4.7-10.fc36            fedora            151 k
 python3-requests_ntlm           noarch           1.1.0-16.fc35            fedora             18 k
 python3-resolvelib              noarch           0.5.5-4.fc36             fedora             31 k
 python3-xmltodict               noarch           0.12.0-14.fc36           fedora             22 k
Installing weak dependencies:
 python3-paramiko                noarch           2.10.4-1.fc36            updates           301 k
 python3-pyasn1                  noarch           0.4.8-8.fc36             fedora            134 k
 python3-winrm                   noarch           0.4.1-5.fc36             fedora             80 k

Transaction Summary
===================================================================================================
Install  15 Packages

Total download size: 36 M
Installed size: 328 M
Is this ok [y/N]: y
Downloading Packages:
(1/15): python3-ntlm-auth-1.5.0-4.fc35.noarch.rpm                  162 kB/s |  53 kB     00:00    
(2/15): python3-packaging-21.3-2.fc36.noarch.rpm                   196 kB/s |  72 kB     00:00    
(3/15): libsodium-1.0.18-9.fc36.x86_64.rpm                         402 kB/s | 163 kB     00:00    
(4/15): python3-pyasn1-0.4.8-8.fc36.noarch.rpm                     698 kB/s | 134 kB     00:00    
(5/15): python3-pynacl-1.4.0-5.fc36.x86_64.rpm                     512 kB/s | 108 kB     00:00    
(6/15): python3-pyparsing-2.4.7-10.fc36.noarch.rpm                 843 kB/s | 151 kB     00:00    
(7/15): python3-requests_ntlm-1.1.0-16.fc35.noarch.rpm             228 kB/s |  18 kB     00:00    
(8/15): python3-xmltodict-0.12.0-14.fc36.noarch.rpm                164 kB/s |  22 kB     00:00    
(9/15): python3-resolvelib-0.5.5-4.fc36.noarch.rpm                 190 kB/s |  31 kB     00:00    
(10/15): python3-winrm-0.4.1-5.fc36.noarch.rpm                     407 kB/s |  80 kB     00:00    
(11/15): python3-bcrypt-3.2.2-1.fc36.x86_64.rpm                    342 kB/s |  43 kB     00:00    
(12/15): python3-jmespath-1.0.0-2.fc36.noarch.rpm                  307 kB/s |  44 kB     00:00    
(13/15): python3-paramiko-2.10.4-1.fc36.noarch.rpm                 458 kB/s | 301 kB     00:00    
(14/15): ansible-core-2.12.5-1.fc36.noarch.rpm                     786 kB/s | 2.4 MB     00:03    
(15/15): ansible-5.7.0-1.fc36.noarch.rpm                           2.0 MB/s |  33 MB     00:16    
---------------------------------------------------------------------------------------------------
Total                                                              2.0 MB/s |  36 MB     00:18     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1 
  Installing       : python3-jmespath-1.0.0-2.fc36.noarch                                     1/15 
  Installing       : python3-bcrypt-3.2.2-1.fc36.x86_64                                       2/15 
  Installing       : python3-xmltodict-0.12.0-14.fc36.noarch                                  3/15 
  Installing       : python3-resolvelib-0.5.5-4.fc36.noarch                                   4/15 
  Installing       : python3-pyparsing-2.4.7-10.fc36.noarch                                   5/15 
  Installing       : python3-packaging-21.3-2.fc36.noarch                                     6/15 
  Installing       : python3-pyasn1-0.4.8-8.fc36.noarch                                       7/15 
  Installing       : python3-ntlm-auth-1.5.0-4.fc35.noarch                                    8/15 
  Installing       : python3-requests_ntlm-1.1.0-16.fc35.noarch                               9/15 
  Installing       : python3-winrm-0.4.1-5.fc36.noarch                                       10/15 
  Installing       : libsodium-1.0.18-9.fc36.x86_64                                          11/15 
  Installing       : python3-pynacl-1.4.0-5.fc36.x86_64                                      12/15 
  Installing       : python3-paramiko-2.10.4-1.fc36.noarch                                   13/15 
  Installing       : ansible-core-2.12.5-1.fc36.noarch                                       14/15 
  Installing       : ansible-5.7.0-1.fc36.noarch                                             15/15 
  Running scriptlet: ansible-5.7.0-1.fc36.noarch                                             15/15 
  Verifying        : libsodium-1.0.18-9.fc36.x86_64                                           1/15 
  Verifying        : python3-ntlm-auth-1.5.0-4.fc35.noarch                                    2/15 
  Verifying        : python3-packaging-21.3-2.fc36.noarch                                     3/15 
  Verifying        : python3-pyasn1-0.4.8-8.fc36.noarch                                       4/15 
  Verifying        : python3-pynacl-1.4.0-5.fc36.x86_64                                       5/15 
  Verifying        : python3-pyparsing-2.4.7-10.fc36.noarch                                   6/15 
  Verifying        : python3-requests_ntlm-1.1.0-16.fc35.noarch                               7/15 
  Verifying        : python3-resolvelib-0.5.5-4.fc36.noarch                                   8/15 
  Verifying        : python3-winrm-0.4.1-5.fc36.noarch                                        9/15 
  Verifying        : python3-xmltodict-0.12.0-14.fc36.noarch                                 10/15 
  Verifying        : ansible-5.7.0-1.fc36.noarch                                             11/15 
  Verifying        : ansible-core-2.12.5-1.fc36.noarch                                       12/15 
  Verifying        : python3-bcrypt-3.2.2-1.fc36.x86_64                                      13/15 
  Verifying        : python3-jmespath-1.0.0-2.fc36.noarch                                    14/15 
  Verifying        : python3-paramiko-2.10.4-1.fc36.noarch                                   15/15 

Installed:
  ansible-5.7.0-1.fc36.noarch                    ansible-core-2.12.5-1.fc36.noarch                
  libsodium-1.0.18-9.fc36.x86_64                 python3-bcrypt-3.2.2-1.fc36.x86_64               
  python3-jmespath-1.0.0-2.fc36.noarch           python3-ntlm-auth-1.5.0-4.fc35.noarch            
  python3-packaging-21.3-2.fc36.noarch           python3-paramiko-2.10.4-1.fc36.noarch            
  python3-pyasn1-0.4.8-8.fc36.noarch             python3-pynacl-1.4.0-5.fc36.x86_64               
  python3-pyparsing-2.4.7-10.fc36.noarch         python3-requests_ntlm-1.1.0-16.fc35.noarch       
  python3-resolvelib-0.5.5-4.fc36.noarch         python3-winrm-0.4.1-5.fc36.noarch                
  python3-xmltodict-0.12.0-14.fc36.noarch       

Complete!
[root@fedora devops]# dnf list available ansible-core
Last metadata expiration check: 0:01:47 ago on Mon 16 May 2022 07:48:42 AM UTC.
Error: No matching Packages to list
[root@fedora devops]# dnf list available ansible
Last metadata expiration check: 0:01:50 ago on Mon 16 May 2022 07:48:42 AM UTC.
Error: No matching Packages to list
[root@fedora devops]# dnf list installed ansible
Installed Packages
ansible.noarch                                5.7.0-1.fc36                                 @updates
[root@fedora devops]# dnf list installed ansible-core
Installed Packages
ansible-core.noarch                             2.12.5-1.fc36                              @updates
[root@fedora devops]# rpm -qa | grep ansible
ansible-core-2.12.5-1.fc36.noarch
ansible-5.7.0-1.fc36.noarch
[root@fedora devops]# ansible --version
ansible [core 2.12.5]
  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.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 12.0.1 20220308 (Red Hat 12.0.1-0)]
  jinja version = 3.0.3
  libyaml = True
[root@fedora devops]#

before execution

$ ssh devops@fedora.example.com
[devops@fedora ~]$ sudo su
[root@fedora devops]# cat /etc/redhat-release 
Fedora release 36 (Thirty Six)
[root@fedora devops]# dnf list available ansible
Available Packages
ansible.noarch                                 5.7.0-1.fc36                                 updates
[root@fedora devops]# dnf list available ansible-core
Last metadata expiration check: 0:00:14 ago on Mon 16 May 2022 07:48:42 AM UTC.
Available Packages
ansible-core.noarch                              2.12.5-1.fc36                              updates
[root@fedora devops]# rpm -qa | grep ansible
[root@fedora devops]# ansible --version
bash: ansible: command not found

after execution

[root@fedora devops]# dnf list available ansible-core
Last metadata expiration check: 0:01:47 ago on Mon 16 May 2022 07:48:42 AM UTC.
Error: No matching Packages to list
[root@fedora devops]# dnf list available ansible
Last metadata expiration check: 0:01:50 ago on Mon 16 May 2022 07:48:42 AM UTC.
Error: No matching Packages to list
[root@fedora devops]# dnf list installed ansible
Installed Packages
ansible.noarch                                5.7.0-1.fc36                                 @updates
[root@fedora devops]# dnf list installed ansible-core
Installed Packages
ansible-core.noarch                             2.12.5-1.fc36                              @updates
[root@fedora devops]# rpm -qa | grep ansible
ansible-core-2.12.5-1.fc36.noarch
ansible-5.7.0-1.fc36.noarch
[root@fedora devops]# ansible --version
ansible [core 2.12.5]
  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.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 12.0.1 20220308 (Red Hat 12.0.1-0)]
  jinja version = 3.0.3
  libyaml = True
[root@fedora devops]#

code with ❤️ in GitHub

See also: How to Run Linux Fedora Workstation 39 on an Apple Mac

Conclusion

Now you know how to install the latest version of Ansible in Fedora using the system repository and the DNF package manager.

Category: installation

Watch the video: How to install Ansible in Fedora 36 - Ansible install — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home