Loading...

Watch: How to install Ansible in Amazon Linux 2 (AWS EC2) - Ansible install

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

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.

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 Extras Library.sh

``bash

#!

Read the full tutorial: How to install Ansible in Amazon Linux 2 (AWS EC2) - Ansible install