Here is how to install Ansible on Fedora 41. Tested and verified.
Prerequisites
- Fedora 41 installed and updated
- Root or sudo access
- Internet connection
Step 1: Update System
sudo dnf update -yStep 2: Choose the Right Package
Fedora has shipped Ansible directly in its main repositories since Fedora 35, so no extra repository needs to be added. Fedora offers two packages — pick the one that fits your use case before installing:
ansible-core— the minimal engine onlyansible— the “batteries included” package that bundles community collections
Step 3: Install Ansible
sudo dnf install -y ansibleOr, for the minimal engine only:
sudo dnf install -y ansible-coreStep 4: Verify Installation
ansible --version
ansible localhost -m pingExpected output shows the installed version, followed by a "ping": "pong" response.
Step 5: Verify Collections and Configuration
# List installed collections
ansible-galaxy collection list
# Install additional collections as needed
ansible-galaxy collection install community.general
# Inspect the active configuration
ansible-config viewAnsible is agentless and has no daemon or background service — it connects to managed hosts over SSH only when you run a command or playbook, so there is nothing to systemctl enable or check with systemctl status.
Troubleshooting
Package Not Found
Refresh the DNF cache and confirm the repos are enabled:
sudo dnf clean all && sudo dnf makecache
dnf repolistdnf5 / libdnf5 Python Module Errors
Fedora 41 ships DNF 5 by default. If Ansible’s dnf/package modules report they can’t import the libdnf5 Python module when managing packages on the local Fedora 41 host, install the matching bindings:
sudo dnf install -y python3-libdnf5This is a known Fedora 41 compatibility issue tracked upstream (see ansible/ansible issues #84206 and #83960).
Uninstall
sudo dnf remove -y ansibleIf you installed the minimal package instead:
sudo dnf remove -y ansible-coreRelated Guides
About the Author
I am Luca Berton, AI and Cloud Advisor. Book a consultation to get help with your infrastructure setup.