In this tutorial, we will show you how to install Ansible on AlmaLinux 8. For those of you who didn’t know, Ansible is a free and open-source automation tool that allows system administrators to configure and control hundreds of nodes from a central server without the need of installing any agents on the nodes. Unlike Puppet and Chef, Ansible is agent-less. Ansible uses declarative language to define system configurations and uses SSH service and Python scripts to apply configurations on the managed nodes.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Ansible on AlmaLinux 8. You can follow the same instructions for CentOS and Rocky Linux.
Install Ansible on AlmaLinux 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf update sudo dnf upgrade sudo dnf install epel-release
Step 2. Installing Python.
Run the following commands to install python 3 and other dependencies:
sudo dnf module install python38 sudo alternatives --config python
Step 3. Installing Ansible on AlmaLinux 8.
- Install Ansible from the official repository AlmaLinux.
Now we run the following command below to install Ansible to your system:
sudo dnf install ansible
- Install Ansible using Python.
Run the following commands to install Ansible:
sudo pip3 install setuptools-rust wheel sudo pip3 install --upgrade pip sudo python -m pip install ansible
Once done, verify the installation using the following command:
$ ansible --version
ansible 2.9.26 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible python version = 3.6.9 (default, Jul 21 2021, 16:00:46) [GCC 8.4.1 20200928 (Red Hat 8.4.2-2)]
Congratulations! You have successfully installed Ansible. Thanks for using this tutorial for installing Ansible on your AlmaLinux 8 system. For additional help or useful information, we recommend you check the official Ansible website.