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 34 - Ansible install

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

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

How to install Ansible in Fedora 34 - Ansible install

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

How to install Ansible in Fedora 34

Today we're talking about How to install Ansible in Fedora 34. 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.9.

## 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

execution

output
# cat /etc/redhat-release 
Fedora release 34 (Thirty Four)

# dnf list available ansible
Last metadata expiration check: 0:15:48 ago on Thu 21 Oct 2021 06:02:41 AM UTC.
Available Packages
ansible.noarch                                2.9.25-1.fc34                                 updates

# dnf install ansible
Last metadata expiration check: 0:16:00 ago on Thu 21 Oct 2021 06:02:41 AM UTC.
Dependencies resolved.
===================================================================================================
 Package                         Architecture     Version                  Repository         Size
===================================================================================================
Installing:
 ansible                         noarch           2.9.25-1.fc34            updates            15 M
Installing dependencies:
 libsodium                       x86_64           1.0.18-7.fc34            fedora            165 k
 python3-bcrypt                  x86_64           3.1.7-7.fc34             fedora             44 k
 python3-jmespath                noarch           0.10.0-1.fc34            updates            46 k
 python3-ntlm-auth               noarch           1.5.0-2.fc34             fedora             53 k
 python3-pynacl                  x86_64           1.4.0-2.fc34             fedora            110 k
 python3-requests_ntlm           noarch           1.1.0-14.fc34            fedora             18 k
 python3-xmltodict               noarch           0.12.0-11.fc34           fedora             23 k
 sshpass                         x86_64           1.09-1.fc34              fedora             27 k
Installing weak dependencies:
 python3-paramiko                noarch           2.7.2-4.fc34             fedora            287 k
 python3-pyasn1                  noarch           0.4.8-4.fc34             fedora            133 k
 python3-winrm                   noarch           0.4.1-2.fc34             fedora             79 k
Transaction Summary
===================================================================================================
Install  12 Packages
Total download size: 16 M
Installed size: 100 M
Is this ok [y/N]: y

Downloading Packages:
(1/12): libsodium-1.0.18-7.fc34.x86_64.rpm                         3.4 MB/s | 165 kB     00:00    
(2/12): python3-jmespath-0.10.0-1.fc34.noarch.rpm                  692 kB/s |  46 kB     00:00    
(3/12): python3-ntlm-auth-1.5.0-2.fc34.noarch.rpm                  511 kB/s |  53 kB     00:00    
(4/12): python3-paramiko-2.7.2-4.fc34.noarch.rpm                   1.3 MB/s | 287 kB     00:00    
(5/12): python3-bcrypt-3.1.7-7.fc34.x86_64.rpm                     112 kB/s |  44 kB     00:00    
(6/12): python3-pyasn1-0.4.8-4.fc34.noarch.rpm                     1.3 MB/s | 133 kB     00:00    
(7/12): python3-requests_ntlm-1.1.0-14.fc34.noarch.rpm             473 kB/s |  18 kB     00:00    
(8/12): python3-pynacl-1.4.0-2.fc34.x86_64.rpm                     886 kB/s | 110 kB     00:00    
(9/12): python3-winrm-0.4.1-2.fc34.noarch.rpm                      1.1 MB/s |  79 kB     00:00    
(10/12): sshpass-1.09-1.fc34.x86_64.rpm                            923 kB/s |  27 kB     00:00    
(11/12): python3-xmltodict-0.12.0-11.fc34.noarch.rpm               196 kB/s |  23 kB     00:00    
(12/12): ansible-2.9.25-1.fc34.noarch.rpm                          3.3 MB/s |  15 MB     00:04    
---------------------------------------------------------------------------------------------------
Total                                                              3.4 MB/s |  16 MB     00:04     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1 
  Installing       : sshpass-1.09-1.fc34.x86_64                                               1/12 
  Installing       : python3-xmltodict-0.12.0-11.fc34.noarch                                  2/12 
  Installing       : python3-pyasn1-0.4.8-4.fc34.noarch                                       3/12 
  Installing       : python3-ntlm-auth-1.5.0-2.fc34.noarch                                    4/12 
  Installing       : python3-requests_ntlm-1.1.0-14.fc34.noarch                               5/12 
  Installing       : python3-winrm-0.4.1-2.fc34.noarch                                        6/12 
  Installing       : python3-bcrypt-3.1.7-7.fc34.x86_64                                       7/12 
  Installing       : libsodium-1.0.18-7.fc34.x86_64                                           8/12 
  Installing       : python3-pynacl-1.4.0-2.fc34.x86_64                                       9/12 
  Installing       : python3-paramiko-2.7.2-4.fc34.noarch                                    10/12 
  Installing       : python3-jmespath-0.10.0-1.fc34.noarch                                   11/12 
  Installing       : ansible-2.9.25-1.fc34.noarch                                            12/12 
  Running scriptlet: ansible-2.9.25-1.fc34.noarch                                            12/12 
  Verifying        : ansible-2.9.25-1.fc34.noarch                                             1/12 
  Verifying        : python3-jmespath-0.10.0-1.fc34.noarch                                    2/12 
  Verifying        : libsodium-1.0.18-7.fc34.x86_64                                           3/12 
  Verifying        : python3-bcrypt-3.1.7-7.fc34.x86_64                                       4/12 
  Verifying        : python3-ntlm-auth-1.5.0-2.fc34.noarch                                    5/12 
  Verifying        : python3-paramiko-2.7.2-4.fc34.noarch                                     6/12 
  Verifying        : python3-pyasn1-0.4.8-4.fc34.noarch                                       7/12 
  Verifying        : python3-pynacl-1.4.0-2.fc34.x86_64                                       8/12 
  Verifying        : python3-requests_ntlm-1.1.0-14.fc34.noarch                               9/12 
  Verifying        : python3-winrm-0.4.1-2.fc34.noarch                                       10/12 
  Verifying        : python3-xmltodict-0.12.0-11.fc34.noarch                                 11/12 
  Verifying        : sshpass-1.09-1.fc34.x86_64                                              12/12
Installed:
  ansible-2.9.25-1.fc34.noarch                       libsodium-1.0.18-7.fc34.x86_64               
  python3-bcrypt-3.1.7-7.fc34.x86_64                 python3-jmespath-0.10.0-1.fc34.noarch        
  python3-ntlm-auth-1.5.0-2.fc34.noarch              python3-paramiko-2.7.2-4.fc34.noarch         
  python3-pyasn1-0.4.8-4.fc34.noarch                 python3-pynacl-1.4.0-2.fc34.x86_64           
  python3-requests_ntlm-1.1.0-14.fc34.noarch         python3-winrm-0.4.1-2.fc34.noarch            
  python3-xmltodict-0.12.0-11.fc34.noarch            sshpass-1.09-1.fc34.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.9/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 20 2021, 00:00:00) [GCC 11.0.0 20210210 (Red Hat 11.0.0-0)]
#

code with ❤️ in GitHub

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

Troubleshooting Common Installation Issues

If ansible --version fails or ansible localhost -m ping returns errors after installing on Fedora 34, the most common root causes are:

1. Wrong Python interpreter

Ansible runs on Python 3. If python3 is not in PATH or points to an old version, Ansible imports may fail. Check with:

python3 --version
which python3
ansible --version | grep "python version"

If the reported Python version is older than 3.10, install a newer interpreter via your distribution's package manager and either re-create your virtualenv or set ansible_python_interpreter in your inventory.

2. SELinux / AppArmor blocking ansible

On security-hardened distributions, mandatory access control can deny Ansible's working directories or block become privilege escalation. Symptoms include "Permission denied" on operations that succeed manually. Check with:

getenforce        # SELinux: should report Permissive or Enforcing
sudo aa-status     # AppArmor: lists profiles in enforce mode

Temporarily set SELinux to permissive (sudo setenforce 0) to confirm whether it's the cause; for production, write a tailored policy rather than disabling enforcement.

3. SSH key authentication failing

If ansible all -m ping works locally but fails for remote managed nodes, the issue is almost always SSH. Verify:

ssh -v user@managed-node 'echo ok'
ansible all -m ping -vvv

The verbose output will show whether the connection drops at TCP, key exchange, or authentication. Common fixes: copy your public key with ssh-copy-id, ensure PubkeyAuthentication yes in /etc/ssh/sshd_config on the managed node, and check that the user exists.

4. pip install conflicts with system packages

If you used pip instead of the system package manager and see "ModuleNotFoundError: No module named 'ansible'", the install likely landed in a virtualenv or user-site directory not on PATH. Check:

pip show ansible-core
pip show ansible
echo $PATH

Install inside a virtualenv to keep system Python clean:

python3 -m venv ~/.venvs/ansible
source ~/.venvs/ansible/bin/activate
pip install ansible

Frequently Asked Questions

What's the difference between ansible and ansible-core?

ansible-core is the engine plus the ansible.builtin collection (~50 modules). The ansible PyPI package bundles ansible-core plus hundreds of community collections, so ansible-galaxy collection list shows everything pre-installed. For minimal Execution Environments and CI, prefer ansible-core and explicitly list collections in requirements.yml.

Should I install Ansible from the package manager or pip?

The system package manager (apt/dnf/apk/pacman) is best for getting started — it installs to PATH and updates with the rest of the OS. Use pip inside a virtualenv when you need a specific version, want to install collections without root, or are building reproducible CI environments. Mixing both on the same system causes PATH ambiguity and is a frequent troubleshooting trap.

How do I update Ansible after the initial install on Fedora 34 -?

If installed via package manager, sudo dnf update ansible (or sudo apt upgrade ansible on Debian-family). If installed via pip, pip install --upgrade ansible inside the same virtualenv. Always read the changelog before crossing a minor version boundary (e.g. 2.18 → 2.19) — there are sometimes deprecation warnings to address before the next major.

Do I need to install anything on the managed nodes?

For Linux managed nodes: only Python 3 and an SSH server. Ansible is "agentless" — it copies its modules over SSH and runs them on the target. For Windows managed nodes you need WinRM or PSRP configured plus PowerShell 5.1+. No Ansible installation is ever required on the target.

Why does ansible localhost -m ping say "SUCCESS"? It's not a real ping.

The ansible.builtin.ping module does not send ICMP. It tests that Ansible can connect to the target, copy a Python module, execute it, and parse the JSON response. A "SUCCESS" reply means the entire transport pipeline works — which is exactly what you want to confirm after install.

See also: How to install Ansible in Fedora 35 - Ansible install

What's Next

Now that Ansible is installed on Fedora 34, build on it:

Conclusion

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

See also

Category: installation

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

Browse all Ansible tutorials · AnsiblePilot Home