Unable to install ansible on CentOS9

I am trying to install the ansible but got the error as follows.
[[email protected] ~]$ sudo yum -y install ansible
Last metadata expiration check: 0:05:14 ago on Mon 13 Jun 2022 12:07:12 PM EDT.
No match for argument: ansible
Error: Unable to find a match: ansible

The system can access to the internet
[[email protected] ~]$ ping www.google.com

64 bytes from hkg07s37-in-f4.1e100.net (142.250.199.68): icmp_seq=1 ttl=117 time=6.51 ms

Hi @jazz32pf ,
Can you please try below commands?

sudo yum install epel-release
sudo yum install ansible

Regards,
KodeKloud Support

[[email protected] ~]$ sudo yum install epel-release
[sudo] password for osboxes:
Last metadata expiration check: 0:01:45 ago on Tue 14 Jun 2022 02:08:41 AM EDT.
No match for argument: epel-release
Error: Unable to find a match: epel-release
[[email protected] ~]$
[[email protected] ~]$ sudo yum install ansible
Last metadata expiration check: 0:02:01 ago on Tue 14 Jun 2022 02:08:41 AM EDT.
No match for argument: ansible
Error: Unable to find a match: ansible
[[email protected] ~]$

Got same result.

Okay, we need to install the epel-release first. @jazz32pf
First install the epel-release pkg: -

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

after that verify it through rpm command: -

sudo rpm -aq | grep epel

and then install the ansible: -

sudo yum install ansible 

Let me know if you are facing any other issues.

Regards,

It works! I am sorry that I am new to Linux, so I wonder how you figure out the issue? I hope I can solve the problem on my own.
[[email protected] ~]$ ansible --version
ansible [core 2.12.6]
config file = /etc/ansible/ansible.cfg
configured module search path = [’/home/osboxes/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/osboxes/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.9 (main, Nov 22 2021, 00:00:00) [GCC 11.2.1 20211019 (Red Hat 11.2.1-6)]
jinja version = 2.11.3
libyaml = True
[[email protected] ~]$

Yes, sure.
As you can see in the below output. epel release pkg is not available.

So I looked into their official page for more instructions.

https://docs.fedoraproject.org/en-US/epel/#_el9

and with help of dnf command, installing the rpm pkg.

Regards,