Installing Ansible on a CentOS system is quite similar to installing it on a RHEL system. Below are the steps you can follow:
Step 1: Enable the EPEL Repository
The EPEL repository provides extra open-source software packages for enterprise Linux. First, you need to enable the EPEL repository. You can do this with the following command:
sudo yum install epel-release
Step 2: Install Ansible
After the EPEL repository is enabled, you can install Ansible with the following command:
sudo yum install ansible
Step 3: Verify the Installation
To verify that Ansible is installed correctly, you can check its version with the following command:
ansible --version
[root@all-in-one-os ~]# ansible --version ansible 2.9.27 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /bin/ansible python version = 2.7.5 (default, Jun 20 2023, 11:36:40) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
This command should return the version of Ansible that is currently installed.
Now Ansible should be installed on your CentOS system. From here, you can start creating playbooks and roles to automate your tasks.
Please remember that to use Ansible, you must have SSH access to the systems you plan to manage. Make sure you have SSH set up and working before you start working with Ansible.