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.

Failed installation of Ansible in Amazon Linux 2022 Preview (AWS EC2) - Ansible install

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

Failed installation of Ansible in Amazon Linux 2022 Preview (AWS EC2) using the internal and the EPEL (Extra Packages for Enterprise Linux) repositories.

Failed installation of Ansible in Amazon Linux 2022 Preview (AWS EC2) - Ansible install

How to install Ansible in Amazon Linux version 2022 Preview?

Today I'm trying to install Ansible in the newest Amazon Linux 2022 Preview. Spoiler alert: it didn't go well! I'm Luca Berton and welcome to today's episode of Ansible Pilot.

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

Links

https://aws.amazon.com/it/linux/amazon-linux-2022/ https://aws.amazon.com/it/linux/amazon-linux-2022/faqs/ https://github.com/amazonlinux

## Playbook

Let's jump in a quick live Playbook of how I tried to install the latest of Ansible in Amazon Linux 2022 Preview.

code

• Install-Ansible-Amazon Linux2022.sh
#!/bin/bash
$ sudo yum update -y
$ sudo yum install ansible
$ ansible --version

execution

$ ssh -i key.pem ec2-user@34.245.160.35
       __|  __|_  )
       _|  (     /   Amazon Linux 2022 AMI
      ___|\___|___|  Preview
http://aws.amazon.com/linux/amazon-linux-2022
[ec2-user@ip-172-31-33-113 ~]$ cat /etc/image-id 
image_name="al2022-ami"
image_version="2022"
image_arch="x86_64"
image_file="al2022-ami-2022.0.20211118.0-kernel-5.10-x86_64.xfs.gpt"
image_stamp="6548-3b38"
image_date="20211119011708"
recipe_name="al2022 ami"
recipe_id="a9b1edc7-a202-b09e-9e6e-3ad0-b75b-4a14-2961cce6"
[ec2-user@ip-172-31-33-113 ~]$ cat /etc/system-release
Amazon Linux release 2022 (Amazon Linux)
[ec2-user@ip-172-31-33-113 ~]$ cat /etc/os-release 
NAME="Amazon Linux"
VERSION="2022"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2022"
PLATFORM_ID="platform:al2022"
PRETTY_NAME="Amazon Linux 2022"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2022"
HOME_URL="https://amazonlinux.com/"
[ec2-user@ip-172-31-33-113 ~]$ sudo su
[root@ip-172-31-33-113 ec2-user]# yum install ansible
Last metadata expiration check: 0:07:05 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: ansible
Error: Unable to find a match: ansible
[root@ip-172-31-33-113 ec2-user]# yum install epel
Last metadata expiration check: 0:07:21 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: epel
Error: Unable to find a match: epel
[root@ip-172-31-33-113 ec2-user]# yum install epel-release
Last metadata expiration check: 0:07:27 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: epel-release
Error: Unable to find a match: epel-release
[root@ip-172-31-33-113 ec2-user]# yum repolist
repo id                                  repo name
amazonlinux                              Amazon Linux 2022 repository
[root@ip-172-31-33-113 ec2-user]# yum search ansible
Last metadata expiration check: 0:08:35 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No matches found.
[root@ip-172-31-33-113 ec2-user]# dnf update
Last metadata expiration check: 0:10:19 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
Dependencies resolved.
Nothing to do.
Complete!
[root@ip-172-31-33-113 ec2-user]# dnf repoinfo
Last metadata expiration check: 0:12:11 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
Repo-id            : amazonlinux
Repo-name          : Amazon Linux 2022 repository
Repo-revision      : 1637274479
Repo-updated       : Thu 18 Nov 2021 10:27:59 PM UTC
Repo-pkgs          : 17,541
Repo-available-pkgs: 17,541
Repo-size          : 18 G
Repo-mirrors       : https://al2022-repos-eu-west-1-9761ab97.s3.dualstack.eu-west-1.amazonaws.com/core/mirrors/2022.0.20211118/x86_64/mirror.list
Repo-baseurl       : https://al2022-repos-eu-west-1-9761ab97.s3.dualstack.eu-west-1.amazonaws.com/core/guids/0e6a211c72356e21402b561f1623752c9bfcd8a88b18993d5477d5f94327f88a/x86_64/
                   : (0 more)
Repo-expire        : 172,800 second(s) (last: Sun 05 Dec 2021 12:51:14 PM UTC)
Repo-filename      : /etc/yum.repos.d/amazonlinux.repo
Total packages: 17,541
[root@ip-172-31-33-113 ec2-user]# dnf install epel-next-release
Last metadata expiration check: 0:13:17 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: epel-next-release
Error: Unable to find a match: epel-next-release
[root@ip-172-31-33-113 ec2-user]# dnf install epel-release
Last metadata expiration check: 0:14:19 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: epel-release
Error: Unable to find a match: epel-release
[root@ip-172-31-33-113 ec2-user]# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Last metadata expiration check: 0:14:59 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
epel-release-latest-8.noarch.rpm                                    53 kB/s |  23 kB     00:00    
Error: 
 Problem: conflicting requests
  - nothing provides redhat-release >= 8 needed by epel-release-8-13.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages)
[root@ip-172-31-33-113 ec2-user]# dnf install redhat-release
Last metadata expiration check: 0:15:40 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: redhat-release
Error: Unable to find a match: redhat-release
[root@ip-172-31-33-113 ec2-user]# yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Last metadata expiration check: 0:15:45 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
epel-release-latest-7.noarch.rpm                                    41 kB/s |  15 kB     00:00    
Error: 
 Problem: conflicting requests
  - nothing provides redhat-release >= 7 needed by epel-release-7-14.noarch
(try to add '--skip-broken' to skip uninstallable packages)
[root@ip-172-31-33-113 ec2-user]# dnf install redhat-release
Last metadata expiration check: 0:15:49 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: redhat-release
Error: Unable to find a match: redhat-release
[root@ip-172-31-33-113 ec2-user]# cat /etc/image-id 
image_name="al2022-ami"
image_version="2022"
image_arch="x86_64"
image_file="al2022-ami-2022.0.20211118.0-kernel-5.10-x86_64.xfs.gpt"
image_stamp="6548-3b38"
image_date="20211119011708"
recipe_name="al2022 ami"
recipe_id="a9b1edc7-a202-b09e-9e6e-3ad0-b75b-4a14-2961cce6"
[root@ip-172-31-33-113 ec2-user]# dnf install ansible
Last metadata expiration check: 0:18:12 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
No match for argument: ansible
Error: Unable to find a match: ansible
[root@ip-172-31-33-113 ec2-user]# dnf repoinfo
Last metadata expiration check: 0:18:37 ago on Sun 05 Dec 2021 12:51:14 PM UTC.
Repo-id            : amazonlinux
Repo-name          : Amazon Linux 2022 repository
Repo-revision      : 1637274479
Repo-updated       : Thu 18 Nov 2021 10:27:59 PM UTC
Repo-pkgs          : 17,541
Repo-available-pkgs: 17,541
Repo-size          : 18 G
Repo-mirrors       : https://al2022-repos-eu-west-1-9761ab97.s3.dualstack.eu-west-1.amazonaws.com/core/mirrors/2022.0.20211118/x86_64/mirror.list
Repo-baseurl       : https://al2022-repos-eu-west-1-9761ab97.s3.dualstack.eu-west-1.amazonaws.com/core/guids/0e6a211c72356e21402b561f1623752c9bfcd8a88b18993d5477d5f94327f88a/x86_64/
                   : (0 more)
Repo-expire        : 172,800 second(s) (last: Sun 05 Dec 2021 12:51:14 PM UTC)
Repo-filename      : /etc/yum.repos.d/amazonlinux.repo
Total packages: 17,541
[root@ip-172-31-33-113 ec2-user]#

code with ❤️ in GitHub

Conclusion

Now you know how I tried to install Ansible in Amazon Linux 2022 and open a Package Request to the Amazon developer team.

See also: Master Ansible Automation for AWS: Complete Guide and Tutorials

Related Articles

automating AWS with Ansiblerole variables and defaults in Ansible

See also

How to install Ansible in Fedora 41

Category: installation

Watch the video: Failed installation of Ansible in Amazon Linux 2022 Preview (AWS EC2) - Ansible install — Video Tutorial

Browse all Ansible tutorials · AnsiblePilot Home