Install ansible on centOS 8; Through this tutorial, we will learn how to install ansible on centOS 8.
How to Install Ansible on CentOS 8
Follow the following steps to install and configure ansible on centOS 8:
- Step 1 – Install Python3
- Step 2 – Install PIP
- Step 3 – Install the Ansible
- Step 4 – Testing the Ansible
- Step 5 – Configure Ansible
Step 1 – Install Python3
Execute the following commands on terminal to update system packages and install python 3 in centOS 8:
sudo dnf update sudo dnf install python3
Execute the following command on terminal to verify python 3 installation:
python3 -V
Step 2 – Install PIP
Execute the following command on terminal to install Python package, which is PIP:
sudo dnf install python3-pip
Step 3 – Install the Ansible
Then execute the following command on terminal to install ansible on centOS 8:
pip3 install ansible --user
To check the version of Ansible, run.
ansible --version
Step 4 – Testing the Ansible
Execute the following command on the terminal to test that ansible is up and running:
sudo systemctl status sshd
Step 5 – Configure Ansible
Execute the following command on terminal to create the hosts
file in the /etc/ansible directory to define host machines:
sudo mkdir /etc/ansible cd /etc/ansible sudo touch hosts
Now open hosts
file with your favorite editor and define the remote node as shown:
192.168.0.104
Next, execute the following command on the terminal to generate SSH keys:
$ ssh-keygen
Conclusion
Through this tutorial, we have learned how to install ansible on centOS 8.