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

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

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

How to install Ansible in Fedora 35 - Ansible install

How to install Ansible in Fedora version 35. Today we're going to talk about the easier way to install and maintain Ansible inside Fedora 35 using the default repository. I'm Luca Berton and welcome to today's episode of Ansible Pilot.

How to install Ansible in Fedora 35

Today we're talking about How to install Ansible in Fedora 35. 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
$ sudo "rpm -qa | grep ansible"
$ sudo dnf list ansible

execution

$ ssh devops@fedora.example.com
[devops@demo ~]$ sudo su
[root@demo devops]# cat /etc/redhat-release 
Fedora release 35 (Thirty Five)
[root@demo devops]# hostnamectl 
 Static hostname: demo.example.com
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 1894b60f7c1a45b9a6fc87cf8a4bed54
         Boot ID: 68bfe9b366c34c8d95df1a3774cf5641
  Virtualization: oracle
Operating System: Fedora Linux 35 (Cloud Edition) 
     CPE OS Name: cpe:/o:fedoraproject:fedora:35
          Kernel: Linux 5.14.10-300.fc35.x86_64
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
[root@demo devops]# dnf list available ansible
Fedora 35 - x86_64                                                 3.3 MB/s |  61 MB     00:18    
Fedora 35 openh264 (From Cisco) - x86_64                           2.7 kB/s | 2.5 kB     00:00    
Fedora Modular 35 - x86_64                                         1.6 MB/s | 2.6 MB     00:01    
Fedora 35 - x86_64 - Updates                                       1.1 MB/s |  15 MB     00:12    
Fedora Modular 35 - x86_64 - Updates                               400 kB/s | 736 kB     00:01    
Available Packages
ansible.noarch                                2.9.27-1.fc35                                 updates
[root@demo devops]# dnf install ansible
Last metadata expiration check: 0:00:14 ago on Fri 03 Dec 2021 03:42:34 PM UTC.
Dependencies resolved.
===================================================================================================
 Package                         Architecture     Version                  Repository         Size
===================================================================================================
Installing:
 ansible                         noarch           2.9.27-1.fc35            updates            15 M
Installing dependencies:
 libsodium                       x86_64           1.0.18-8.fc35            fedora            161 k
 python3-bcrypt                  x86_64           3.2.0-1.fc35             fedora             43 k
 python3-jmespath                noarch           0.10.0-4.fc35            fedora             46 k
 python3-ntlm-auth               noarch           1.5.0-4.fc35             fedora             53 k
 python3-pynacl                  x86_64           1.4.0-4.fc35             fedora            108 k
 python3-requests_ntlm           noarch           1.1.0-16.fc35            fedora             18 k
 python3-xmltodict               noarch           0.12.0-13.fc35           fedora             22 k
 sshpass                         x86_64           1.09-2.fc35              fedora             27 k
Installing weak dependencies:
 python3-paramiko                noarch           2.7.2-6.fc35             fedora            288 k
 python3-pyasn1                  noarch           0.4.8-7.fc35             fedora            134 k
 python3-winrm                   noarch           0.4.1-4.fc35             fedora             80 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): python3-bcrypt-3.2.0-1.fc35.x86_64.rpm 317 kB/s | 43 kB 00:00 (2/12): python3-jmespath-0.10.0-4.fc35.noarch.rpm 323 kB/s | 46 kB 00:00 (3/12): libsodium-1.0.18-8.fc35.x86_64.rpm 704 kB/s | 161 kB 00:00 (4/12): python3-ntlm-auth-1.5.0-4.fc35.noarch.rpm 566 kB/s | 53 kB 00:00 (5/12): python3-pyasn1-0.4.8-7.fc35.noarch.rpm 1.5 MB/s | 134 kB 00:00 (6/12): python3-paramiko-2.7.2-6.fc35.noarch.rpm 1.4 MB/s | 288 kB 00:00 (7/12): python3-requests_ntlm-1.1.0-16.fc35.noarch.rpm 827 kB/s | 18 kB 00:00 (8/12): python3-pynacl-1.4.0-4.fc35.x86_64.rpm 935 kB/s | 108 kB 00:00 (9/12): python3-xmltodict-0.12.0-13.fc35.noarch.rpm 848 kB/s | 22 kB 00:00 (10/12): sshpass-1.09-2.fc35.x86_64.rpm 580 kB/s | 27 kB 00:00 (11/12): python3-winrm-0.4.1-4.fc35.noarch.rpm 1.3 MB/s | 80 kB 00:00 (12/12): ansible-2.9.27-1.fc35.noarch.rpm 1.4 MB/s | 15 MB 00:11 --------------------------------------------------------------------------------------------------- Total 1.3 MB/s | 16 MB 00:12 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : sshpass-1.09-2.fc35.x86_64 1/12 Installing : python3-xmltodict-0.12.0-13.fc35.noarch 2/12 Installing : python3-pyasn1-0.4.8-7.fc35.noarch 3/12 Installing : python3-ntlm-auth-1.5.0-4.fc35.noarch 4/12 Installing : python3-requests_ntlm-1.1.0-16.fc35.noarch 5/12 Installing : python3-winrm-0.4.1-4.fc35.noarch 6/12 Installing : python3-jmespath-0.10.0-4.fc35.noarch 7/12 Installing : python3-bcrypt-3.2.0-1.fc35.x86_64 8/12 Installing : libsodium-1.0.18-8.fc35.x86_64 9/12 Installing : python3-pynacl-1.4.0-4.fc35.x86_64 10/12 Installing : python3-paramiko-2.7.2-6.fc35.noarch 11/12 Installing : ansible-2.9.27-1.fc35.noarch 12/12 Running scriptlet: ansible-2.9.27-1.fc35.noarch 12/12 Verifying : libsodium-1.0.18-8.fc35.x86_64 1/12 Verifying : python3-bcrypt-3.2.0-1.fc35.x86_64 2/12 Verifying : python3-jmespath-0.10.0-4.fc35.noarch 3/12 Verifying : python3-ntlm-auth-1.5.0-4.fc35.noarch 4/12 Verifying : python3-paramiko-2.7.2-6.fc35.noarch 5/12 Verifying : python3-pyasn1-0.4.8-7.fc35.noarch 6/12 Verifying : python3-pynacl-1.4.0-4.fc35.x86_64 7/12 Verifying : python3-requests_ntlm-1.1.0-16.fc35.noarch 8/12 Verifying : python3-winrm-0.4.1-4.fc35.noarch 9/12 Verifying : python3-xmltodict-0.12.0-13.fc35.noarch 10/12 Verifying : sshpass-1.09-2.fc35.x86_64 11/12 Verifying : ansible-2.9.27-1.fc35.noarch 12/12

Installed: ansible-2.9.27-1.fc35.noarch libsodium-1.0.18-8.fc35.x86_64 python3-bcrypt-3.2.0-1.fc35.x86_64 python3-jmespath-0.10.0-4.fc35.noarch python3-ntlm-auth-1.5.0-4.fc35.noarch python3-paramiko-2.7.2-6.fc35.noarch python3-pyasn1-0.4.8-7.fc35.noarch python3-pynacl-1.4.0-4.fc35.x86_64 python3-requests_ntlm-1.1.0-16.fc35.noarch python3-winrm-0.4.1-4.fc35.noarch python3-xmltodict-0.12.0-13.fc35.noarch sshpass-1.09-2.fc35.x86_64

Complete! [root@demo devops]# rpm -qa | grep ansible ansible-2.9.27-1.fc35.noarch [root@demo devops]# ansible --version ansible 2.9.27 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 executable location = /usr/bin/ansible python version = 3.10.0 (default, Oct 4 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] [root@demo devops]# yum list installed google-chrome-stable Error: No matching Packages to list [root@demo devops]# yum list installed ansible Installed Packages ansible.noarch 2.9.27-1.fc35 @updates [root@demo devops]# dnf list installed ansible Installed Packages ansible.noarch 2.9.27-1.fc35 @updates [root@demo devops]#

before execution

$ ssh devops@fedora.example.com
[devops@demo ~]$ sudo su
[root@demo devops]# cat /etc/redhat-release 
Fedora release 35 (Thirty Five)
[root@demo devops]# hostnamectl
 Static hostname: demo.example.com
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 1894b60f7c1a45b9a6fc87cf8a4bed54
         Boot ID: 68bfe9b366c34c8d95df1a3774cf5641
  Virtualization: oracle
Operating System: Fedora Linux 35 (Cloud Edition) 
     CPE OS Name: cpe:/o:fedoraproject:fedora:35
          Kernel: Linux 5.14.10-300.fc35.x86_64
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
[root@demo devops]# dnf list installed ansible
Error: No matching Packages to list
[root@demo devops]# dnf list ansible
Last metadata expiration check: 0:03:45 ago on Fri 03 Dec 2021 03:42:34 PM UTC.
Available Packages
ansible.noarch                                 2.9.27-1.fc35                                 updates
[root@demo devops]#

after execution

[root@demo devops]# rpm -qa | grep ansible
ansible-2.9.27-1.fc35.noarch
[root@demo devops]# ansible --version
ansible 2.9.27
  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
  executable location = /usr/bin/ansible
  python version = 3.10.0 (default, Oct  4 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)]
[root@demo devops]# yum list installed google-chrome-stable
Error: No matching Packages to list
[root@demo devops]# yum list installed ansible
Installed Packages
ansible.noarch                                2.9.27-1.fc35                                 @updates
[root@demo devops]# dnf list installed ansible
Installed Packages
ansible.noarch                                2.9.27-1.fc35                                 @updates
[root@demo devops]#

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 35, 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 35 -?

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

What's Next

Now that Ansible is installed on Fedora 35, build on it: • Write your first playbookAnsible inventory: organize your hostsAnsible variables and facts explainedPrivilege escalation with becomeBrowse all Ansible tutorials

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: How to install Ansible in Fedora 36 - Ansible install

Ansible role best practices

Category: installation

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

Browse all Ansible tutorials · AnsiblePilot Home