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 AlmaLinux 10

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

Step-by-step guide to install Ansible on AlmaLinux 10. Install and configure Ansible using dnf package manager on the latest AlmaLinux release.

How to install Ansible in AlmaLinux 10

How to Install Ansible in AlmaLinux 10

In this guide, I'll show you how to install Ansible on AlmaLinux 10. I'm Luca Berton, and I'll walk you through the installation using dnf.

See also: Install Ansible on AlmaLinux 8 Easily with EPEL

Prerequisites

• AlmaLinux 10 system • SSH access or terminal • Root or sudo privileges • Internet connection

Step-by-Step Installation

Step 1: Connect via SSH

ssh devops@almalinux10.yournetwork.com

Step 2: Become Root

sudo su -

Step 3: Update the System

dnf update -y

Step 4: Enable EPEL Repository

dnf install epel-release -y

Step 5: Install Ansible

dnf install ansible-core -y

Step 6: Verify Installation

ansible --version

Step 7: Test Ansible

ansible localhost -m ping

See also: How to install Ansible in AlmaLinux 9 - Ansible install

Alternative: Install via pip

dnf install python3-pip -y
pip3 install 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 EOF

See also: Efficient Web Server Setup Using Ansible Playbook

FAQ

Is AlmaLinux 10 compatible with RHEL 10?

Yes. AlmaLinux 10 is binary-compatible with RHEL 10, so all Ansible modules for RHEL work on AlmaLinux.

Should I use ansible-core or the full ansible package?

Start with ansible-core and add collections as needed with ansible-galaxy collection install.

Troubleshooting Common Installation Issues

If ansible --version fails or ansible localhost -m ping returns errors after installing on AlmaLinux 10, 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 AlmaLinux 10?

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.

What's Next

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

Conclusion

You've successfully installed Ansible on AlmaLinux 10. For more guides, visit AnsiblePilot.

Related Articles

Ansible Galaxy authenticationbecome directives in AnsibleAnsible inventory file structure

Category: installation

Browse all Ansible tutorials · AnsiblePilot Home