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 41

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

Step-by-step guide to install Ansible on Fedora 41. Learn how to install, configure, and verify Ansible automation tool using dnf package manager on Fedora 41.

How to install Ansible in Fedora 41

How to Install Ansible in Fedora 41

In this guide, I'll walk you through installing Ansible on Fedora 41 Linux. I'm Luca Berton, and I'll show you the step-by-step process using the dnf package manager.

See also: Efficient Web Server Setup Using Ansible Playbook

Prerequisites

  • Fedora 41 system (Workstation or Server)
  • SSH access or terminal
  • Root or sudo privileges
  • Internet connection

Step-by-Step Installation

Step 1: Connect via SSH

ssh devops@fedora41.yournetwork.com

Step 2: Become Root

sudo su -

Step 3: Update the System

dnf update -y

Step 4: Check Available Ansible Packages

dnf list ansible*

Expected output:

Available Packages
ansible-core.x86_64          2.17.x-1.fc41          updates
ansible-collection-*.noarch  various                 fedora

Step 5: Install Ansible

dnf install ansible-core -y

Step 6: Verify Installation

ansible --version

Expected output:

ansible [core 2.17.x]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.13/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.13.x

Step 7: Test Ansible

ansible localhost -m ping

Expected output:

localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Configuration and First Steps

Create Ansible Configuration

mkdir -p /etc/ansible
cat > /etc/ansible/ansible.cfg << 'EOF'
[defaults]
inventory = /etc/ansible/hosts
remote_user = devops
host_key_checking = False

[privilege_escalation]
become = True
become_method = sudo
become_user = root
become_ask_pass = False
EOF

Create Initial Inventory

cat > /etc/ansible/hosts << 'EOF'
[local]
localhost ansible_connection=local

[webservers]
# Add your web servers here

[databases]
# Add your database servers here
EOF

Install Additional Collections

ansible-galaxy collection install community.general
ansible-galaxy collection install ansible.posix

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

Install Full Ansible Package (Optional)

If you need the full Ansible package with all collections:

pip3 install ansible

FAQ

What is the difference between ansible-core and ansible?

ansible-core includes the engine and builtin modules. The full ansible package adds many community collections. Start with ansible-core and add collections as needed.

Can I install Ansible via pip instead?

Yes: pip3 install ansible. The pip version is often newer than the dnf package.

Does Fedora 41 use Python 3.13?

Yes, Fedora 41 ships with Python 3.13. Ansible is fully compatible.

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

Conclusion

You've successfully installed Ansible on Fedora 41. You're now ready to start automating your infrastructure.

For more installation guides and Ansible tutorials, visit AnsiblePilot.

Category: installation

Browse all Ansible tutorials · AnsiblePilot Home