Unable to install ansible on CentOS9

I am trying to install the ansible but got the error as follows.
[osboxes@ansible-controller ~]$ 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
[osboxes@ansible-controller ~]$ 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

[osboxes@ansible-controller ~]$ 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
[osboxes@ansible-controller ~]$
[osboxes@ansible-controller ~]$ 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
[osboxes@ansible-controller ~]$

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,

1 Like

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.
[osboxes@ansible-controller ~]$ 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
[osboxes@ansible-controller ~]$

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.

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

Regards,

Hi team,
while installing Ansible getting below error

[osboxes@ansiblecontroller ~]$ sudo yum install ansible
Last metadata expiration check: 0:06:35 ago on Sun 19 Feb 2023 01:25:03 AM EST.
Error:
Problem: conflicting requests

  • nothing provides /usr/bin/python3.9 needed by ansible-6.3.0-2.el8.1.noarch
  • nothing provides python(abi) = 3.9 needed by ansible-6.3.0-2.el8.1.noarch
  • nothing provides python3.9dist(ansible-core) >= 2.13.3 needed by ansible-6.3.0-2.el8.1.noarch
    (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)

can you plz help me to install ansible

Hi @namratasawalamdocs,
Please install the epel-release package as per the OS version.

Hello All,

after install epel package still getting same error:

[root@ANSIBLE_CONTROLLER /]# sudo yum install ansible
Last metadata expiration check: 0:10:49 ago on Wed 20 Mar 2024 07:27:39 PM UTC.
Error:
Problem: cannot install the best candidate for the job

  • nothing provides python(abi) = 3.11 needed by ansible-8.3.0-1.el8.noarch
  • nothing provides python3.11dist(ansible-core) >= 2.15.3 needed by ansible-8.3.0-1.el8.noarch
  • nothing provides /usr/bin/python3.11 needed by ansible-8.3.0-1.el8.noarch
    (try to add ‘–skip-broken’ to skip uninstallable packages or ‘–nobest’ to use not only best candidate packages)

I would recommend you get ansible through pip - it will be a more up to date version than that provided by the OS Package Manager:

sudo yum install -y python3 python3-pip
pip install ansible
1 Like

Need to access by root!!!

[root@ansible-controller ~]$ dnf list ansible-core
CentOS Stream 9 - BaseOS 58 kB/s | 8.0 MB 02:22
CentOS Stream 9 - AppStream 173 kB/s | 19 MB 01:52
Last metadata expiration check: 0:00:05 ago on Fri 19 Apr 2024 02:16:14 PM EDT.
Available Packages
ansible-core.x86_64 1:2.14.14-1.el9 appstream

[root@ansible-controller ~]$ dnf info ansible-core

[root@ansible-controller ~]$ dnf install ansible-core

[root@ansible-controller ~]$ ansible --version
ansible [core 2.14.14]

It is working good.

That doesn’t seem to be a problem – it looks like you successfully installed ansible.

I have tried the way through pip but it was not working.

Proceed with changes? [N/y] y

  • Waiting in queue…
  • Waiting for authentication… Failed to install packages: Failed to obtain authentication.

I was going through dnf and it is working well.