Home Linux guides Ansible Introduction to Ansible: Ansible basics and Installation in Rocky Linux 8.

Introduction to Ansible: Ansible basics and Installation in Rocky Linux 8.


Ansible is an open-source IT automation platform, which is very simple to set up, efficient, and more powerful. Ansible is very ideal for configuration management, Application deployment, task automation, and IT orchestrations. It is available for free and runs on Linux, macOS, and BSD-based systems. Although Ansible is open-source software, there is an enterprise product called Ansible Tower.

Features of Ansible

Ansible has a number of features, which makes it a very useful tool for IT automation. let’s evaluate the features of Ansible.

  • Ansible is free and open source.
  • Ansible is agentless.
  • Ansible uses SSH to communicate to the nodes.
  • Ansible requires minimal system requirements.
  • Ansible is developed in Python, hence inbuilt in most units and large deployments.
  • Ansible is lightweight.
  • Ansible is easy to deploy and requires no additional custom security infrastructure.
  • Ansible uses YAML syntax in configuration files.YAML is a very simple language which looks like plain english.
  • Ansible has Larger community since its community based. This therefore makes looking for help very easy.

We turn our attention to some Ansible Terminologies.

Ansible Terminologies.

Before we get deeper into Ansible, it’s very important to familiarise ourselves with some of the common terminologies used in the Ansible world to understand its functionality. These include the following:-

A playbook is the language in which Ansible configures, administrates, deploys systems, automates tasks and orchestrations. Playbooks are written in YAML format and syntax. It is the core building block of Ansible.

YAML – YAML is used by Ansible to define playbook configuration languages as well as variable files. It has a minimum syntax and is very easy to learn.

Task – Playbooks run tasks. Tasks combine modules with their arguments with name.

Handlers – They are special tasks that only run when notified by name when a task reports a change in the remote system.

Tasks – a list of task.

Roles – are units of organization in Ansible. Assigning a specific role to a group of hosts implements a certain behavior to that group.

Plays – A playbook is a list of plays. A play is a mapping between a set of hosts and the tasks which run on the hosts.

Modules – These are units of work that Ansible ships to the nodes.

Inventory – A file that defines hosts and Groups in Ansible.

Host – A remote machine managed by Ansible.

Facts – Things discovered about remote nodes.

Ansible Galaxy – An online resource for finding and sharing Ansible content.

Ad-Hoc – running Ansible to run quick commands.

For a full list of terminologies, visit: https://docs.ansible.com/ansible/latest/reference_appendices/glossary.html

How Ansible works.

Ansible communicates with the nodes by sending little programs known as “Ansible modules” to them. These programs are intended to be resource models of the ideal state of the system. Ansible then executes these modules (through SSH by default) and removes them after they are completed.

Ansible Installation

Before you install Ansible in your system:


  1. The control node must have Python 2.7 or Python 3 installed.
  2. The local hosts must have SSH installed.

In this article, I will install Ansible in Rocky Linux 8.

Step 1 : Update and upgrade your system.

This is the best practice before any installation.

sudo dnf -y update
sudo dnf -y upgrade

Step 2 : Install Python 3.

To install Python 3 in your system, run the following command as root.

sudo dnf install python3

To view the version installed :

python3 --version

The output of the two commands:

sudo dnf install python3
Last metadata expiration check: 7:33:19 ago on Fri 08 Oct 2021 05:21:55 PM EAT.
Package python36-3.6.8-2.module+el8.4.0+597+ddf0ddea.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
[[email protected] ~]$ python3 --version
Python 3.6.8

Python 3.6.8 is already installed on my machine.

Step 3 : Install Ansible

To install Ansible you must enable EPEL. This is because the Ansible package is not available for the Rocky Linux distro. The package and its dependencies are available in Extra Packages for Enterprise Linux (EPEL)

Run the commands below to install Ansible.

sudo dnf install epel-release
sudo dnf install ansible

To see the version of Ansible installed:

ansible --version

The output of the command:

ansible --version
ansible 2.9.25
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/Jil/.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.8 (default, Sep 21 2021, 18:40:00) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]

From the output, we also get to see the default Ansible Configuration file which is /etc/ansible/ansible.cfg, and the version of Ansible installed.

Congratulations, you have installed Ansible in your system.


In this brief article, we have looked at an introduction to Ansible, its features, few terminologies, how it works, and its installation in Rocky Linux 8. Be sure to check for more details on the ansible official website.

This article acts as an introduction to Ansible. In the coming articles, we will have an in-depth view of Ansible.

Thank you and feel free to leave a comment below.


Please enter your comment!
Please enter your name here