How to install Ansible on RHEL8?
Hey guys, you must have heard about the Ansible automation tool and you may wish to use that. You may have encountered a question that how you can install ansible on RHEL8. Before going to the setup part it’s necessary that you have some basic idea what is ansible? First read that and after that, we are going to install ansible
There are not as such prerequisites but you must have installed RHEL8 OS or centos8 in your system and an active internet connection is required.
Ansible is open-source software and hence we can download that easily for free. I have RHEL8 installed using Virtualbox and I am using putty to config. Generally, in RHEL8 for installing any software we use the yum/dnf command but in case of ansible if you try to run
yum install ansible
This will show there is not any software like Ansible. No match found for argument: ansible.
Ansible is written in python language and pip is the command to install the package for python. Python has two major versions Python 2 and Python 3. We are going to set up using python 3 and for this, we have to use pip3.
Note: If you want to know more about Python language you can go through this link >> Python Introduction
Use pip3 install ansible to install the ansible. But there may be a case you don’t have pip installed in your system and in that case you have to first download pip in your system. Now, if you try to install pip using the command yum install pip3.
You will find there is no argument match with pip3. How to install pip now? If you know something about the yum command you definitely know that there is a command yum whatprovides [package_name]. This command tells about the package that can help us to download the pip3
Use yum whatprovides pip3
This will show that there is a software python36 that provides the pip3. Install pyton36 by yum command.
Once python36 is installed, you can run pip3 install ansible now.
We can confirm our installation by using ansible –version command.
Now after the successful installation of Ansible, we need two things
- one to create an inventory file
- another to configure that inventory file with our Ansible software.
You can give any name to your inventory file. I am using vi /etc/myhosts.txt. vi is a very powerful editor in RedHat and most widely used.
Inside our inventory file, we put all the IP’s of our managed nodes. In order to remotely login, we will need sshpass software. If you try to download the sshpass using yum you will find the software is not there. The software which provides the sshpass can be downloaded from this link.
The size will around 20kb. You can also go to their official site here is the link. Choose the latest version 8. After downloading by using WinSCP you can transfer the file from windows to your RHEL system.
Using ls command you can list all the available directories and files. By this you will get the rpm file is there. To add the package to your yum repolist use rpm -ivh [file_name].
If you use yum repolist, you can see there are some other packages there and Now use yum install sshpass to install the sshpass. Once this installed now you can edit your inventory file and configure the ansible.
Here we will write our inventory path with the default header.
CONNECT WITH THE AUTHOR ON LINKEDIN.
VISIT OUR WEBSITE BRIGHTERBEES FOR MORE INTERESTING STUFFS.
IF YOU WANT TO KNOW ABOUT WHAT IS ANSIBLE click here.