In order to install Ansible on Centos 8; epel-release package needs to be installed. Due to Centos8 end of life, no new packages and security updates are not maintained and all repos has moved under vault.centos.org thus CentOS-* repos need to replace then we can install epel-release. Once you install epel-release ansilbe installation gives below error since June 2022.
- nothing provides (ansible-core >= 2.12.2 with ansible-core < 2.13) needed by ansible-5.4.0-2.el8.noarch (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)