What Is Ansible & How Does It Work?

what is ansible

What is Ansible?

Ansible can be defined as a software tool that is developed to provide automation that is not only simple but delivers high-level performance for cross-platform computer support. 

It was initially devised for IT professionals for their use for the deployment of applications, workstations and server updates, cloud provisioning,  intra-service orchestration,  configuration management, and all those things that a systems administrator carries on a weekly or daily basis. Ansible is easy to deploy because it doesn’t depend on the agent software and has no additional security infrastructure.

Since Ansible is completely related to automation, it needs to be instructed to accomplish each job. To make version control easy, everything must be written down in simple script form. The practical result of this is considered a big contribution to the “infrastructure as code” movement in IT. It refers to the notion that maintaining server and client infrastructure needs to be regarded as software development, with repositories of self-documenting, tried-and-true, and executable solutions capable of maintaining an organization despite staffing changes.

Along with being a great player in automation, DevOps, and systems administration, it is very useful to everyday users too. Ansible can be configured on a whole network of computers at once rather than just one computer; for doing that, no programming skills are required. Humans can read the instructions written for Ansible. An entirely new computer user or expert can easily understand Ansible files.

What Does Cross-Platform Mean in Ansible?

A cross-platform computer system or the item is one that is made to function in a variety of operating systems or platforms.

Systems that require separate versions for each platform, systems that work the same way across several platforms, and other more general systems are all examples of different cross-platform systems.

Cross-platform can also be said as multi-platform or platform independent.

Ansible Highlights


Michael DeHaan, the author of the provisioning server application Cobbler and co-author of the Fedora Unified Network Controller (Func) framework for remote administration, developed the Ansible tool, open-source software, in 2012, and Red Hat acquired it in 2015.

Derivation of Name

Ursula K. Le Guin, an American author, coined the term “ansible” to narrate fictitious instantaneous communication systems in her 1966 novel Rocannon’s World.


The aim of developing Ansible was to simplify real-world server automation problems.


Ansible versions get released in the interval of 4 to 6 months, depending upon the changes from version to version. As a standard operating procedure, each version is tested before its release. All Ansible versions are shown below:

Before 1.9

1.9 (1.9.1 to 1.9.6)

2.0 (2.0.1 to 2.0.3)

2.1 (2.1.1 to 2.1.6)

2.2 (2.2.1 to 2.2.4)

2.3 (2.3.1 to 2.3.4)

2.4 (2.4.1 to 2.4.7)

2.5 (2.5.1 to 2.5.15)

2.6 (2.6.1 to 2.6.20)

2.7 (2.7.1 to 2.7.16)

2.8 (2.8.1 to 2.8.8)

2.9 (2.9.1 to 2.9.4)

Initial version Before 1.9 was started as a project. The latest available version of Ansible is 2.9. This version was generally available on 6 Nov 2019; its end of life is 31 Dec 2021.

What Does Ansible Do?

Though the term Ansible modules give a sense of complexity, Ansible handles most of the complexity, and the user is not involved in it.

A module is written in such a way that it represents the desired state of a system, meaning that each module can define what should be the true conditions on any given managed node.

For example, in an organization, if a system administrator decides that all the workstations should run on LibreOffice version X.Z, then at this moment, Ansible comes into action. Its packaging modules start checking to confirm the current state of the workstations, and when it finds that some nodes are running on LibreOffice X.Y, then it is upgraded to LibreOffice version X.Z. Likewise, any workstation in an organization is upgraded a night with the help of the software.

How Does Ansible Work?

There are mainly two computer categories in Ansible: the managed node and the control node.

The control node, which is a computer, is responsible for running Ansible. At least one control node should be there; a backup control node may also exist in parallel. A managed node can be any device that is managed by the control node.

Ansible’s standard operating procedure is that it first gets connected to nodes such as servers, clients, or anything that needs to be configured and then sends a small program known as the Ansible module to that node. Then these modules are executed by Ansible over SSH, and these modules are removed when the execution is completed.

The important thing for this interaction is that Ansible control nodes must have login access to the managed nodes. The SSH keys provide this access. Other forms of authentication are also providing helping hands.

Disadvantages of Ansible

There are some disadvantages of Ansible that create some sort of setbacks among the users. Let’s see them one by one:

1. Insufficient User Interface

  • Unsuccessful synchronization between the GUI and the command line results in conflicting query results. 
  • Ansible Tower is still in development and unable to do everything like a command-line interface.

2. Lack Of Any Notion of State

  • In contrast to other automation tools like Puppet, Ansible does not offer any concept of state.
  • Ansible cannot keep track of dependencies; instead, it merely conducts sequential tasks and comes to an end when they are finished, fails, or encounter any errors.

3. Limited Windows Support

  • The limited support for Windows in Ansible creates formidable setbacks with the configuration management and automation tool.

4. Ansible Does Not Have Experience

  • Less enterprise support experience also shrinks the appeal of Ansible. 
  • Lack of full-fledged working experience with large enterprises like its competitors, such as Puppet and Chef (Read: Chef vs Puppet). 

5. Ansible Is New To The Market

  • Unlike its renowned competitors, being new to the market results in a lack of a large developer or user community. 
  • Since Ansible is new to the market, there is a possibility of undiscovered bugs, software issues, and edge scenarios.

Ansible – Roles

Roles in Ansible provide a framework for collections of variables, files, tasks, modules, and templates that are fully independent or interdependent.

In Ansible, the role acts as a primary mechanism to break a playbook into multiple files. This makes complex playbook writing simple and can be reused easily. The purpose of breaking the playbook is carried out so that it can be broken into reusable components.

Each role is assigned a particular functionality for desired output.

Roles are small functionality within playbooks that can be independently used. In any conditions, a role can not be executed directly. 

Top-level playbooks act as a bridge that holds the hosts from the user’s inventory file to roles that should be applied to those hosts.

What Is An Ansible playbook?

The main purpose of an Ansible module is to accomplish a specific task, and the way of utilizing them is through an Ansible playbook. An Ansible playbook can be defined as a configuration file written in YAML (Yet Another Markup Language) to provide instructions for things that need to be done to bring a managed node into the required state.

Playbooks are easily read by humans, and self-documenting. They are also considered idempotent, meaning they can be run on a system anytime without hurting it.

If a playbook is run on a system, like properly configured and in its desired state, then also that system gets configured properly after a playbook runs.

A playbook can be very simple. For example, look at this that installs as a privileged user, the Apache HTTP server, on any node in an IT department’s web servers group:

name: Apache server installed

hosts: web servers

become: yes

With conditionals and variables, Playbooks can also be very complex types. As the most primary work is performed by Ansible modules, playbooks remain brief, readable, and clear even though they manage entire networks of managed nodes.

Ansible – YAML Basics

In Ansible, YAML syntax is used for the expression of Ansible playbooks. Let’s have an overview of YAML. Ansible uses YAML because humans can very easily understand, read and write it compared to other data formats such as XML and JSON.

All the YAML files will generally start with “—” and will end with “…”.

Understanding YAML

This section is meant to teach the different ways in which the YAML data is represented.

key-value pair

In YAML, a simple key-value pair is used for the data representation.

Note: Keep space between: and value.

Example: A student record


Abbreviations can also be used for the representation of dictionaries.


James carter: {name: james carter, rollNo: 44, div: D, sex: male

Representing List

YAML allows representation of the List. Every element(member) of the list is to be written in a new line with the same indentation starting with “-“ (-and space).




List inside Dictionaries

The list inside dictionaries can be used in YAML, i.e., the value of the key is a list.



             name: james carter

             rollNo: 44

             div: D

             sex: male






List Of Dictionaries

A list of dictionaries can also be made.



             name: james carter

             rollNo: 44

             div: D

             sex: male






             name: peter

             rollNo: 20

             div: E

             sex: male






Let us understand the different YAML tags. The different tags are explained below:


The use of this tag to specify the name of the Ansible playbook. As per the role of the playbook, any logical name can be given to the playbook.


The use of this tag is to specify the lists of hosts or host groups against which the task is to be run. The hosts’ field/tag is mandatory. It informs Ansible which hosts the listed tasks are to be run. The tasks can either be run on the same machine or a remote machine. One can run the tasks on multiple machines, and the tag should also have a group of hosts’ entries for that host.


The use of the Vars tag is to define the variables to use in the playbook. Usage variables in the same way as in any other programming language.


All playbooks should have tasks or a list of tasks that are required to be executed. Tasks can be defined as a list of actions that need to be performed. The name of the task is contained in a tasks field. This works as a helping text to the user. However, it is not mandatory but is useful while debugging the playbook. Each task is linked internally to a piece of code which is called a module. 

It is to be noted that arguments are required to be mentioned for the execution of a module.

Common Playbook Issues

This section summaries a few common playbook issues that are as follows:

The playbook is written in YAML format, and the above two are considered the most common issues in the YAML/playbook.

Both tabs-based indentation and supported space-based indentation are not supported by YAML, so while writing syntax, one should be careful about the same.

Ansible – Troubleshooting

The following modules are considered very useful, effective, and the most common strategy for debugging Ansible playbooks:

Debug and Register

These two modules available in Ansible are very useful for debugging purposes and should be used judiciously. 

Use Verbosity

Ansible command is used to provide the verbosity level. Run the command with verbosity level one (-v) or two (-vv).


As a last thought, we draw the conclusion that Ansible exists to offer a straightforward and effective package for configuration management and automation. Being new to the software application market, Ansible has to face tough competition from renowned sources. The availability of a limited amount of Ansible-related documentation creates setbacks for learning Ansible.

On a positive note, a growing interest can be seen in Ansible due to its adoption by NASA. The potentiality of Ansible can be described by its functionalities such as provisioning, application, orchestration, deployment, and security and compliance. 

Ansible’s benefits could be strengthened while the disadvantages are being addressed; by achieving this, a promising future for Ansible can be foreseen.

In this article, we have tried our best to cover as maximum as possible important aspects of Ansible to make you aware of this technology in the best possible way.

Frequently Asked Questions

How To Learn Ansible?

Ansible can be learned by using it at home or work. For someone new to YAML (a human-readable data serialization language &  commonly used for configuration files but could be used in many applications where data is being stored), it is advised to take some time learning it and then only write the first playbook.

On a small scale, it can be installed on a personal computer and used to manage itself or just a few computers on a home network. 

To be comfortable using and configuring new modules, it is an important recommendation to try different modules.

These are sources to make nodes conform to an infrastructure design, and Ansible is the engine that can make it possible.

Is Ansible Difficult To Learn?

Getting familiar with Ansible hardly takes a week for a beginner level, so no prerequisites are required. Suppose someone has Linux operating system knowledge, especially in administration, experience, and visualization. In that case, less than one week is enough to know what Ansible is and how it operates practically.

Leave a Reply

Your email address will not be published.