On most Linux distribution, Ansible can be installed either using python3-pip or ansible package.

I’m going to show how to get Ansible installed using the second method on CentOS 8.

First add the EPEL repository to the CentOS 8 server.

# yum localinstall https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Next, install ansible package:

# yum install ansible
Last metadata expiration check: 0:00:49 ago on Sun 10 Nov 2019 09:33:22 PM AEDT.
Dependencies resolved.
=======================================================================================================================
 Package                           Arch                  Version                        Repository                Size
=======================================================================================================================
Installing:
 ansible                           noarch                2.8.5-2.el8                    epel                      15 M
Installing dependencies:
 python3-babel                     noarch                2.5.1-3.el8                    AppStream                4.8 M
 python3-jinja2                    noarch                2.10.1-2.el8_0                 AppStream                538 k
 python3-jmespath                  noarch                0.9.0-11.el8                   AppStream                 45 k
 python3-markupsafe                x86_64                0.23-19.el8                    AppStream                 39 k
 python3-pyasn1                    noarch                0.3.7-6.el8                    AppStream                126 k
 libsodium                         x86_64                1.0.18-2.el8                   epel                     162 k
 python3-bcrypt                    x86_64                3.1.6-2.el8.1                  epel                      44 k
 python3-pynacl                    x86_64                1.3.0-5.el8                    epel                     100 k
 sshpass                           x86_64                1.06-9.el8                     epel                      27 k
Installing weak dependencies:
 python3-paramiko                  noarch                2.4.3-1.el8                    epel                     289 k

Transaction Summary
=======================================================================================================================
Install  11 Packages

Total download size: 21 M
Installed size: 104 M
Is this ok [y/N]: 

Let’s confirm that the installation went ok by checking the version of ansible:

$ ansible --version
ansible 2.8.5
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/student/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Oct  7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]

References: