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 Amazon Linux 2023 — Ansible install

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

Install Ansible on Amazon Linux 2023 with this 2026 guide. Step-by-step instructions using pip for the latest Ansible version on AWS.

How to install Ansible in Amazon Linux 2023 — Ansible install

Introduction

Amazon Linux 2023 is a popular choice for server and desktop environments, and combining it with Ansible enables powerful automation capabilities. This guide walks you through installing Ansible on Amazon Linux 2023, from updating your system to verifying the installation and running your first Ansible command.

See also: How to install Ansible in Debian 13 Trixie — Ansible install

Prerequisites

Before you begin, ensure that you have: • Access to a Amazon Linux 2023 system with root or sudo privileges. • An active internet connection to download necessary packages. • Python 3.11 or later installed (included by default in Amazon Linux 2023).

Step-by-Step Installation

Connect to Your Server Initiate an SSH connection from your terminal:
ssh devops@amazon-linux-2023.example.com
Switch to Root User For installing system-wide software:
sudo su
Update System Packages Before installing any new software, update your system:
dnf update

Confirm any prompts to ensure your system has the latest updates. Check Available Ansible Packages Verify which Ansible packages are available:

pip3 list 2>/dev/null | grep ansible
Install Ansible Using the dnf/pip package manager, install Ansible:
pip3 install ansible

This command installs Ansible along with its dependencies. Confirm the installation when prompted. Verify the Installation Once installation is complete, check the installed version:

ansible --version

This command displays the version of Ansible and configuration details, confirming a successful installation.

See also: How to install Ansible in Fedora 40 — Ansible install

Configuration and First Steps

Configure Ansible Ansible configurations can be adjusted in the ansible.cfg file located in /etc/ansible/. Customize settings like default inventory file, privilege escalation settings, and more. Edit the Inventory File Ansible uses an inventory file to track managed servers:
[local]
localhost ansible_connection=local

[webservers] web1.example.com web2.example.com

Test Ansible Connectivity Ensure that Ansible can communicate with your hosts:

ansible all -m ping

Expected output:

localhost | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}

Conclusion

With Ansible installed on Amazon Linux 2023, you are now ready to automate your infrastructure. Whether managing configurations, deploying applications, or automating daily tasks, Ansible provides the tools necessary for efficient and error-free operations.

Start by creating simple playbooks to familiarize yourself with Ansible's capabilities, and gradually progress to more complex automations. The vast community-driven library of modules and roles available through Ansible Galaxy can significantly reduce your scripting efforts and ensure reliable, repeatable configurations across your environment.

For more Ansible tutorials and guides, explore the complete article collection on Ansible Pilot.

See also: How to install Ansible in Fedora 43 — Ansible install

Related Articles

using Ansible Galaxy for collectionsbecome and privilege escalation explainedstatic and dynamic Ansible inventoryCloudFormation alternatives with AnsibleAnsible roles guide

Category: installation

Browse all Ansible tutorials · AnsiblePilot Home