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 2 (AWS EC2) - Ansible install — Video Tutorial

How to install Ansible in Amazon Linux 2 using the Amazon Extras Library 'amazon-linux-extras' and the EPEL (Extra Packages for Enterprise Linux).

Watch on YouTube · Read the written article

Tutorial summary

What you'll learn

  • How to install Ansible in Amazon Linux 2
  • Links
  • Playbook
  • Amazon Extras Library code
  • Amazon Extras Library execution
  • Amazon Extras Library after execution
  • EPEL code
  • EPEL execution
  • EPEL after execution
  • Install a Modern Ansible with pip
How to install Ansible in Amazon Linux version 2? Today we're going to talk about the easier way to install and maintain Ansible inside Amazon Linux 2 using the Amazon Extras Library and EPEL repositories. I'm Luca Berton and welcome to today's episode of Ansible Pilot. > **Important (2026 update):** Both the `amazon-linux-extras` and EPEL methods below install the legacy **Ansible 2.9**, which is end-of-life and predates `ansible-core`/collections. They still work, but for a current Ansible install the supported approach is **pip** (see the [pip on the right Python](#install-a-modern-ansible-with-pip) section). Also note that **Amazon Linux 2 reaches end of standard support on 30 June 2026** — for new workloads use [Amazon Linux 2023](/articles/ansible-on-amazon-linux-2023-automation-complete-guide). How to install Ansible in Amazon Linux 2 - "ansible2" topic in Extras Library repository - "ansible" in Extra Packages for Enterprise Linux (EPEL) additional packages for Enterprise Linux: Red Hat Enterprise Linux (RHEL), Rocky Linux and Scientific Linux (SL), Oracle Linux (OL), and Amazon Linux Today we're talking about How to install Ansible in Amazon Linux 2. The good news is that Ansible is included in the Extras Library included in Amazon Linux 2 repository using the "amazon-linux-extras" command. Another option is to install and maintain Ansible inside Amazon Linux 2 is using the Extra Packages for Enterprise Linux (EPEL) additional repository. This repository is maintained by the Fedora Special Interest Group and manages a high-quality set of additional packages for Enterprise Linux: Red Hat Enterprise Linux (RHEL), Rocky Linux and Scientific Linux (SL), Oracle Linux (OL), and Amazon Linux. Links - [Amazon Linux 2](https://aws.amazon.com/it/amazon-linux-2/) - [How do I enable the EPEL repository for my Amazon EC2 instance running CentOS, RHEL, or Amazon Linux?](https://aws.amazon.com/it/premiumsupport/knowledge-center/ec2-enable-epel/) - [Extras library (Amazon Linux 2)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-ami-basics.html#extras-library) - [Extra Packages for Enterprise Linux (EPEL)](https://docs.fedoraproject.org/en-US/epel/) Playbook Install Ansible in Amazon Linux (EC2) 2 using the Amazon Extras Library and EPEL repositories. Here are the steps on how to install Ansible in Amazon Linux 2 (AWS EC2): 1. Update the package list: ```bash $ sudo yum update -y ``` 2. Install the Ansible package: ```bash $ sudo amazon-linux-extras install ansible2 -y ``` 3. Check the Ansible version: ```bash $ ansible --version ``` 4. Verify that Ansible is installed correctly by running a simple playbook: ```bash $ ansible localhost -m ping ``` This playbook will print the following output: ```bash localhost | SUCCESS => { "changed": false, "ping": "pong" } ``` If you see this output, then Ansible is installed and configured correctly. Amazon Extras Library code - Install-Ansible-Amazon Linux2-Amazon

About this tutorial

  • Author: Luca Berton
  • Difficulty: Beginner
  • Read time: 19 min
  • Category: installation

Topics covered

Related video tutorials