Skip to main content

Ansible

Ansible is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows. It includes its own declarative language to describe system configuration. Ansible was written by Michael DeHaan and acquired by Red Hat in 2015. Ansible is agentless, temporarily connecting remotely via SSH or Windows Remote Management (allowing remote PowerShell execution) to do its tasks.

License: Proprietary / GNU General Public License

Written in: Python, PowerShell, Shell, Ruby

Developer(s): Ansible Community / Ansible Inc. / Red Hat Inc

Operating system: Linux, Unix-like, MacOS, Windows

Stable release: 2.11.3 / 20 July 2021

Why Ansible?

A single bash script would be great if you have to manage and configure a single system, you are the single user and yours is a single machine. But when you scale up across more computers, multiple tasks, more users and more admins, you will discover that the bash scripts are not enough and efficient. This is exactly where Ansible comes into the picture. Ansible can be treated as nurtured bash or shell scripting that can configure your huge infrastructure topology in one go.

Plus, Ansible uses a very simple language called YAML (YAML Ain't Markup Language) in the form of Ansible playbooks that allows you to describe your automation task in a way that is as good as colloquial language.

What Ansible Does?

The term Ansible modules sounds complex, but most of the complexity is handled by Ansible and not the user. An Ansible module is written to be a model of the desired state of a system, meaning that each module defines what should be true on any given managed node. For instance, if a systems administrator decides that all workstations in an organization should have LibreOffice version X.Z installed, then it's up to Ansible's packaging module to determine whether each node has LibreOffice X.Z on it. Should Ansible find a managed node with LibreOffice X.Y installed, then it detects the operating system and runs the necessary routine to update it to LibreOffice X.Z. In this way, every workstation in an organization can be updated overnight with the software supported by the IT department.

How Ansible works?

In Ansible, there are two categories of computers: the control node and managed nodes. The control node is a computer that runs Ansible. There must be at least one control node, although a backup control node may also exist. A managed node is any device being managed by the control node.

Ansible works by connecting to nodes (clients, servers, or whatever you're configuring) on a network, and then sending a small program called an Ansible module to that node. Ansible executes these modules over SSH and removes them when finished. The only requirement for this interaction is that your Ansible control node has login access to the managed nodes. SSH keys are the most common way to provide access, but other forms of authentication are also supported.

What are the Advantages of Ansible?

  1. Ansible manages the machines in an agentless You do not have to install any Ansible agents/service software on the client machine.
  2. Both push and pull of files/commands/codes are supported in Ansible.
  3. Ansible is a security-focused tool. And it uses OpenSSH as the secure transport protocol.
  4. Ansible scripts (popularly called as playbooks) are written in YAML and hence they are very easy to read.
  5. The core idea here is that you only do things if they are needed and things that are repeated without side effects.
  6. If needed, then Ansible can easily connect with Kerberos, LDAP (Lightweight Directory Access Protocol) and other centralized authentication management systems.
  7. An advantage of higher order significance is that one need not be an expert in bash or shell scripting. Ansible has it handled by itself. So, the work becomes quite easy and straightforward with Ansible.
  8. One doesn't really need to be a root user to run the Ansible playbook tasks on the nodes. It can acquire root privileges.

References-

Wikipedia Link

Official Website

Red Hat Ansible Automation Platform

Ansible Documentation

Ansible Installation

Github Repository

Contributed by- @anjalikundliya05