How to install Ansible in Fedora 42
By Luca Berton · Published 2024-01-01 · Category: installation
Step-by-step guide to install Ansible on Fedora 42. Learn how to install, configure, and verify Ansible automation tool using dnf package manager on Fedora 42.

How to Install Ansible in Fedora 42
In this guide, I'll walk you through installing Ansible on Fedora 42 Linux. I'm Luca Berton, and I'll show you the step-by-step process using the dnf package manager.
See also: How to Run Linux Fedora Workstation 39 on an Apple Mac
Prerequisites
• Fedora 42 system (Workstation or Server) • SSH access or terminal • Root or sudo privileges • Internet connectionStep-by-Step Installation
Step 1: Connect via SSH
ssh devops@fedora42.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*
Step 5: Install Ansible
dnf install ansible-core -y
Step 6: Verify Installation
ansible --version
Expected output:
ansible [core 2.18.x]
config file = /etc/ansible/ansible.cfg
ansible python module location = /usr/lib/python3.14/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.14.x
Step 7: Test Ansible
ansible localhost -m ping
Expected output:
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
See also: How to install Ansible in Fedora 34 - Ansible install
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
EOF
FAQ
Is Fedora 42 the latest Fedora release?
As of 2026, Fedora 42 is the current release. Fedora releases approximately every 6 months.Should I use dnf or pip to install Ansible?
Usednf for system-managed Ansible that integrates with Fedora. Use pip3 install ansible for the latest upstream version.
See also: How to install Ansible in Fedora 35 - Ansible install
Conclusion
You've successfully installed Ansible on Fedora 42. Start automating your infrastructure today.
For more installation guides, visit AnsiblePilot.
Related Articles
• how Ansible become works under the hood • static and dynamic Ansible inventoryPost-Installation Setup
# Create project directory
mkdir -p ~/ansible/{inventory,group_vars,roles}
# Create ansible.cfg
cat > ~/ansible/ansible.cfg << EOF
[defaults]
inventory = inventory/hosts
host_key_checking = False
retry_files_enabled = False
stdout_callback = yaml
[privilege_escalation]
become = True
become_method = sudo
EOF
# Test installation
ansible localhost -m ansible.builtin.ping
ansible localhost -m ansible.builtin.setup | head -20
First Playbook on Fedora 42
---
- name: Configure Fedora 42 workstation
hosts: localhost
connection: local
become: true
tasks:
- name: Install development tools
ansible.builtin.dnf:
name:
- gcc
- make
- git
- python3-devel
- vim-enhanced
state: present
- name: Install Flatpak apps
community.general.flatpak:
name: "{{ item }}"
state: present
loop:
- com.visualstudio.code
- org.mozilla.firefox
FAQ
Is Ansible available in Fedora 42's default repos?
Yes. Both ansible-core and the full ansible package are in Fedora's default repositories. No additional repos needed.
Can I use Fedora 42 as an Ansible control node?
Yes. Fedora makes an excellent control node with up-to-date Python and Ansible packages. Use dnf install ansible-core for a minimal install.
Category: installation