Ansible is an open-source automation tool, which commonly used for IT tasks such as installation and configuration of any software on multiple nodes and also codes deployment on development or production environment. Any IT person can easily use Ansible because Ansible is easy to install, easy to deploy and configure on multiple nodes. Ansible works on SSH protocol, which is present on every Linux system. This article guides you on how to automate the installation of ansible On Centos 8.
Check the following git hub link to automate the installation of ansible On Centos 8 using script. Download the git repo and run the install-ansible.sh script on the instance where you want to install the ansible.

Git Hub Repo:
https://github.com/smarttechfunda/install-ansible.git

The command to Download git repo:
$ git clone -b release/1.0.1 https://github.com/smarttechfunda/install-ansible.git
$ cd install-ansible

$ chmod +x install-ansible
$ ./install-ansible

OR use the following step to install and configure ansible manually.

Note:
Log in as a non-root user, but the user should have sudo permission.

Step 1:
Install Python3
$ sudo yum install python3
$ python -V

Step 2:
Install python3-pip
$ sudo yum install python3-pip

Step 3:
Install ansible
On Ubuntu 18.20, 20.08:
$ sudo apt install ansible -y
On CentOS 8:
$ sudo yum install -y epel-release && sudo yum install -y ansible
/etc/ansible/hosts: This is an inventory file for the nodes. You can add the number of nodes in this file.
Make the following entry at bottom of the "/etc/ansible/hosts" file.
For example:
[test]
192.168.0.104

Note: Skip step 5 and follow from step 6 directly.
OR
$ pip3 install ansible --user
Note: Do not skip any step after the above pip3 install command.

Ansible installation process
Ansible Installation

Step 4:
Test Ansible on the remote instance
Check the ssh service is running.
$ systemctl status sshd

SSH service running before test the ansible
SSH Service

Step 5:
Create the Ansible directory structure
Create the ansible directory under /etc/ path and create the hosts file under the /etc/ansible path on ansible instance.
$ sudo mkdir /etc/ansible
$ sudo touch /etc/ansible/hosts
/etc/ansible/hosts:
This is an inventory file for the nodes. You can add the number of nodes in this file.
Make the following entry to the "/etc/ansible/hosts" file.
For example:
[test]
192.168.0.104

Step 6:
Passwordless SSH
Create the SSH key
Create the SSH keys and copy the public key on the remote node.
$ ssh-keygen

Create the private and public key using command ssh-keygen
SSH KeyGen

Step 6:
Copy ssh public key on the remote node
Run the following command to copy the ssh key on the remote node.
$ ssh-copy-id ansible@<remote_host_ip>
For example:
$ ssh-copy-id ansible@192.168.0.104

Step 7:
Test Ansible
Run the following command to test the ansible on the remote node.
$ ansible -i /etc/ansible/hosts test -m ping

Test ansible on remote node using ping command
Test Ansible

Convert the shell script to binary file automation:

Git hub repo:
https://github.com/smarttechfunda/shell-to-binary.git
The command to Download git repo:
git clone https://github.com/smarttechfunda/shell-to-binary.git