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

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

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

How to install Ansible in Fedora 37 - Ansible install

How to install Ansible in Fedora version 37.

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

I'm Luca Berton and welcome to today's episode of Ansible Pilot.

How to install Ansible in Fedora 37

Today we're talking about How to install Ansible in Fedora 37.

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.14 for ansible-core and 6.4 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 update
sudo dnf list available ansible
sudo dnf install ansible
sudo "rpm -qa | grep ansible"
sudo dnf list ansible

execution

[luca@fedora ~]$ sudo su
[sudo] password for luca: 
[root@fedora luca]# cat /etc/redhat-release 
Fedora release 37 (Thirty Seven)
[root@fedora luca]# hostnamectl
   Static hostname: n/a                                  
Transient hostname: fedora
         Icon name: computer-vm
           Chassis: vm 🖴
        Machine ID: d2529b15dd1248ff98eb849bea4769ff
           Boot ID: 25ddcebe009247d285a8acef12f3d2ca
    Virtualization: vmware
  Operating System: Fedora Linux 37 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:37
            Kernel: Linux 6.0.7-301.fc37.aarch64
      Architecture: arm64
   Hardware Vendor: VMware, Inc.
    Hardware Model: VMware20,1
  Firmware Version: VMW201.00V.20432347.BA64.2209100127
[root@fedora luca]# cat /etc/os-release 
NAME="Fedora Linux"
VERSION="37 (Workstation Edition)"
ID=fedora
VERSION_ID=37
VERSION_CODENAME=""
PLATFORM_ID="platform:f37"
PRETTY_NAME="Fedora Linux 37 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:37"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f37/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=37
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=37
VARIANT="Workstation Edition"
VARIANT_ID=workstation
[root@fedora luca]# ansible
bash: ansible: command not found...
Install package 'ansible-core' to provide command 'ansible'? [N/y] n

[root@fedora luca]# dnf list available ansible Copr repo for PyCharm owned 375 B/s | 341 B 00:00 Last metadata expiration check: 1:34:46 ago on Tue 29 Nov 2022 06:32:17 PM GMT. Available Packages ansible.noarch 7.0.0~b1-1.fc37 updates [root@fedora luca]# dnf list available ansible-core Last metadata expiration check: 1:35:06 ago on Tue 29 Nov 2022 06:32:17 PM GMT. Available Packages ansible-core.noarch 2.14.0-1.fc37 updates [root@fedora luca]# rpm -qa | grep ansible [root@fedora luca]# ansible --version bash: ansible: command not found... Install package 'ansible-core' to provide command 'ansible'? [N/y] n

[root@fedora luca]# dnf install ansible Last metadata expiration check: 1:35:51 ago on Tue 29 Nov 2022 06:32:17 PM GMT. Dependencies resolved. ============================================================= Package Arch Version Repo Size ============================================================= Installing: ansible noarch 7.0.0~b1-1.fc37 updates 43 M Installing dependencies: ansible-core noarch 2.14.0-1.fc37 updates 3.6 M python3-jinja2 noarch 3.0.3-5.fc37 fedora 630 k python3-resolvelib noarch 0.5.5-6.fc37 fedora 43 k

Transaction Summary ============================================================= Install 4 Packages

Total download size: 48 M Installed size: 334 M Is this ok [y/N]: y Downloading Packages: (1/4): python3-resolvelib-0. 92 kB/s | 43 kB 00:00 (2/4): python3-jinja2-3.0.3- 557 kB/s | 630 kB 00:01 (3/4): ansible-core-2.14.0-1 943 kB/s | 3.6 MB 00:03 (4/4): ansible-7.0.0~b1-1.fc 1.5 MB/s | 43 MB 00:29 ------------------------------------------------------------- Total 1.5 MB/s | 48 MB 00:31 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : python3-resolvelib-0.5.5-6.fc37.n 1/4 Installing : python3-jinja2-3.0.3-5.fc37.noarc 2/4 Installing : ansible-core-2.14.0-1.fc37.noarch 3/4 Installing : ansible-7.0.0~b1-1.fc37.noarch 4/4 Running scriptlet: ansible-7.0.0~b1-1.fc37.noarch 4/4 Verifying : python3-jinja2-3.0.3-5.fc37.noarc 1/4 Verifying : python3-resolvelib-0.5.5-6.fc37.n 2/4 Verifying : ansible-7.0.0~b1-1.fc37.noarch 3/4 Verifying : ansible-core-2.14.0-1.fc37.noarch 4/4

Installed: ansible-7.0.0~b1-1.fc37.noarch ansible-core-2.14.0-1.fc37.noarch python3-jinja2-3.0.3-5.fc37.noarch python3-resolvelib-0.5.5-6.fc37.noarch

Complete! [root@fedora luca]# ansible --version ansible [core 2.14.0] 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.11/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.11.0 (main, Oct 24 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-2)] (/usr/bin/python3) jinja version = 3.0.3 libyaml = True [root@fedora luca]# rpm -qa | grep ansible ansible-core-2.14.0-1.fc37.noarch ansible-7.0.0~b1-1.fc37.noarch [root@fedora luca]# dnf list installed ansible Installed Packages ansible.noarch 7.0.0~b1-1.fc37 @updates [root@fedora luca]# dnf list installed ansible-core Installed Packages ansible-core.noarch 2.14.0-1.fc37 @updates [root@fedora luca]# ansible --version ansible [core 2.14.0] 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.11/site-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/bin/ansible python version = 3.11.0 (main, Oct 24 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-2)] (/usr/bin/python3) jinja version = 3.0.3 libyaml = True [root@fedora luca]#

before execution


[root@fedora luca]# ansible
bash: ansible: command not found...
Install package 'ansible-core' to provide command 'ansible'? [N/y] n

[root@fedora luca]# dnf list available ansible Copr repo for PyCharm owned 375 B/s | 341 B 00:00 Last metadata expiration check: 1:34:46 ago on Tue 29 Nov 2022 06:32:17 PM GMT. Available Packages ansible.noarch 7.0.0~b1-1.fc37 updates [root@fedora luca]# dnf list available ansible-core Last metadata expiration check: 1:35:06 ago on Tue 29 Nov 2022 06:32:17 PM GMT. Available Packages ansible-core.noarch 2.14.0-1.fc37 updates [root@fedora luca]# rpm -qa | grep ansible [root@fedora luca]# ansible --version bash: ansible: command not found... Install package 'ansible-core' to provide command 'ansible'? [N/y] n

after execution


[root@fedora luca]# rpm -qa | grep ansible
ansible-core-2.14.0-1.fc37.noarch
ansible-7.0.0~b1-1.fc37.noarch
[root@fedora luca]# dnf list installed ansible
Installed Packages
ansible.noarch            7.0.0~b1-1.fc37            @updates
[root@fedora luca]# dnf list installed ansible-core
Installed Packages
ansible-core.noarch          2.14.0-1.fc37           @updates
[root@fedora luca]# ansible --version
ansible [core 2.14.0]
  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.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.0 (main, Oct 24 2022, 00:00:00) [GCC 12.2.1 20220819 (Red Hat 12.2.1-2)] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
[root@fedora luca]#

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

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

Related Articles

rendering Jinja2 templates with Ansible

Category: installation

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

Browse all Ansible tutorials · AnsiblePilot Home