Home  »  ArticlesGuidesHow ToSoftwareTechnologyTools   »   Steps to Install Ansible in AlmaLinux 8.10 Systems

Steps to Install Ansible in AlmaLinux 8.10 Systems

Ansible is a popular open-source automation tool used for configuration management, application deployment, and task automation. It is simple to set up and use, making it a preferred choice for many system administrators. This guide will walk you through the steps to install Ansible on an AlmaLinux 8.10 system.

Prerequisites

Before starting, ensure you have:

  • A running AlmaLinux 8.10 system
  • A user account with sudo privileges
  • Internet connectivity to download necessary packages

Step 1: Update Your System

Begin by updating your system to ensure all existing packages are up to date. This helps prevent any compatibility issues during the installation process.

$ sudo dnf update -y

Step 2: Install EPEL Repository

Ansible is available in the EPEL (Extra Packages for Enterprise Linux) repository. Install the EPEL repository to gain access to Ansible packages.

$ sudo dnf install epel-release -y

Step 3: Install Ansible

With the EPEL repository enabled, you can now install Ansible using the dnf package manager.

$ sudo dnf install ansible -y

Step 4: Verify the Installation

After the installation is complete, verify that Ansible is installed correctly by checking its version.

$ ansible --version

You should see output similar to this, indicating the installed version of Ansible:

ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/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.8 (default, Jun 11 2019, 15:15:01) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)]

Step 5: Configure Ansible

Ansible’s configuration file is located at /etc/ansible/ansible.cfg. While the default configuration is sufficient for many users, you may want to tweak it to suit your specific needs.

Open the configuration file with a text editor, such as nano:

$ sudo nano /etc/ansible/ansible.cfg

Make any necessary changes, then save and exit the text editor. Common configurations include setting the default inventory file and enabling logging.

Step 6: Create an Inventory File

Ansible uses an inventory file to manage and define the hosts it will manage. Create a simple inventory file to get started.

$ sudo nano /etc/ansible/hosts

Add the IP addresses or domain names of the hosts you want to manage. For example:

[webservers]
192.168.1.100
192.168.1.101

[dbservers]
192.168.1.102

Save and exit the text editor.

Step 7: Test Your Setup

To ensure that Ansible can communicate with your managed hosts, run a simple ping test.

$ ansible all -m ping

You should see output indicating that Ansible successfully reached the specified hosts:

192.168.1.100 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.1.101 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
192.168.1.102 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Conclusion

You have successfully installed and configured Ansible on your AlmaLinux 8.10 system. Ansible is now ready to help you automate your IT tasks, from managing configurations to deploying applications. For more detailed information on using Ansible, refer to the official Ansible documentation.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.