Ansible and How Does It Work
Ansible and How Does It Work
Search Spiceworks
Privacy - Terms
Login Join
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 1/21
12/10/23, 8:39 PM Ansible and How Does it Work
Login Join
DevOps
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 2/21
12/10/23, 8:39 PM Ansible and How Does it Work
Table of Contents
What Is Ansible?
Features of Ansible
What Is Ansible?
Ansible is defined as an open-source, cross-platform tool for resource
provisioning automation that DevOps professionals popularly use for
continuous delivery of software code by taking advantage of an
“infrastructure as code” approach.
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 3/21
12/10/23, 8:39 PM Ansible and How Does it Work
Over the years, the Ansible automation platform has evolved to deliver
sophisticated automation solutions for operators, administrators, and IT decision-
makers across various technical disciplines. It’s a leading enterprise automation
solution with flourishing open-source software and the unofficial standard in IT
automated systems. It operates on several Unix-like platforms and can manage
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 4/21
12/10/23, 8:39 PM Ansible and How Does it Work
systems like Unix and Microsoft architectures. It comes with descriptive language
for describing system settings. Michael DeHaan created Ansible, which Red Hat
acquired in 2015.
Ansible is an agentless system that executes actions over remote SSH or Windows
Remote Management connections (allowing remote PowerShell execution). Ansible
is an open-source IT automation engine that may help you save time at work while
simultaneously improving the scalability, consistency, and dependability of your IT
infrastructure.
See More: DevOps vs. Agile Methodology: Key Differences and Similarities
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 5/21
12/10/23, 8:39 PM Ansible and How Does it Work
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 6/21
12/10/23, 8:39 PM Ansible and How Does it Work
4. Configuration management
Ansible is a simple, trustworthy, and consistent configuration management
solution. You can set it up quickly if you have prior experience in IT. Ansible
configurations are descriptions of fundamental infrastructure data humans can
read and process by computers. You only require passwords or an SSH (Secure
Socket Shell) key to begin monitoring machines.
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 7/21
12/10/23, 8:39 PM Ansible and How Does it Work
Provisioning: The first step toward automating the life cycle of your
applications is to set up your hardware. One can use Ansible to set up cloud
platforms, network hardware devices, virtualized hosts, and bare metal
servers, among other equipment. Users can set up the numerous servers
needed in the computer network during provisioning.
Compliance and security – Site-wide security policies, like rules for firewall
software, can be used with other automated processes. When you set up the
security information on the control device and run the playbook that goes
with it, the security information is automatically adjusted on the various
connected servers.
See More: DevOps Engineer: Job Description, Key Skills, and Salary in 2022
The management node sets up an SSH connection before executing the modules
and installing the product on the host workstations. Once the modules have been
deployed, it eliminates them. So that’s how it works with Ansible. Python is used to
create an Ansible script and connects remote hosts through SSH, specified in the
inventory file. Ansible is agentless – implying that it doesn’t need any program to
be installed on the nodes it controls.
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 8/21
12/10/23, 8:39 PM Ansible and How Does it Work
Ansible takes inventory data to determine which machines you wish to control. It
has a default inventory file, but users can customize it to manage the servers they
want to. To link to servers and conduct tasks, Ansible employs the SSH protocol.
Ansible establishes a connection with the remote system and distributes the
modules required for command or playbook execution. Ansible uses human-
readable YAML templates to allow the automation of repetitive processes without
the need to master a complex programming language.
You could use Ansible’s built-in modules to automate, or you can develop your own
processes. Creating Ansible modules is possible using any programming language
that can return JSON, including Ruby, Python, and shell. Powershell is used to
develop Windows automation modules. It also stores your application’s history
information, enabling you to repeal to a previous standard or update it simply. It
provides the following advantages:
Ansible is a free and open-source software tool that all can access.
Ansible’s playbooks do not need coding expertise for installation and usage;
they are straightforward to configure and use.
You can orchestrate the whole app environment regardless of where the
application is deployed.
It has no agent in the client machines you desire to automate, and one must
open no additional software or firewall ports.
Since no extra software is necessary, servers have a greater capacity for app
resources, resulting in increased efficiency.
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 9/21
12/10/23, 8:39 PM Ansible and How Does it Work
1. Modules
Modules are essential software that Ansible delivers from the command computer
to all nodal network points or distant hosts. They are predetermined instructions
that are executed directly on remote hosts. Playbooks run modules that manage
applications, packages, and files. Ansible executes all modules for delivering
updates or performing the required activity and then eliminates them after they’re
through. Ansible has over 450 modules for typical tasks. Ansible has hundreds of
built-in modules, the pieces of code that are run when a playbook is launched. A
playbook has plays, containing various tasks that include modules.
2. Playbooks
Playbooks for Ansible are task-specific user guides. Playbooks dictate your
workflow since functions written in them are executed in the order they are
written. They are simple text documents created in YAML, a data serialization
language that humans understand. They are at the heart of what makes Ansible so
attractive since they describe the tasks one must perform quickly without requiring
the user to remember particular terminology. In addition to being able to describe
settings, they may also orchestrate the stages of any manually arranged task and
conduct tasks concurrently or sequentially.
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 10/21
12/10/23, 8:39 PM Ansible and How Does it Work
3. Plugins
Plugins are little pieces of code that augment a website’s functionality. Ansible
comes with several of these, but one can create their own. Plugins are a specific
type of module in this case. Before a module is performed on the nodes, the
plugins are run. For logging reasons, plugins are executed on the primary control
unit. You have call-back plugins because they allow you to connect to various
Ansible events for display and reporting. To minimize the costs of fact-gathering
processes, cache plugins are used. Action plugins are front-end modules that
perform operations on the controller system prior to invoking the modules
directly.
4. Inventories
The inventory comprises all the nodes or hosts that need to be taken care of, along
with their IP addresses, server details, databases, and other information. All
machines (control and nodes) used with Ansible are listed in a single, easy-to-read
file containing this comprehensive data. After registering the inventory, you can
assign parameters to multiple hosts using a simple text-based format.
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 11/21
12/10/23, 8:39 PM Ansible and How Does it Work
7. Cloud
A private or public cloud is a collection of distant servers that one may use to
collect, organize, and process information. Rather than keeping data on a local
server, these systems are hosted over the internet. It simply deploys the cloud
resources and instances, links them to the databases, and you’re ready to handle
your job remotely.
Features of Ansible
Here are the core features of Ansible that one should remember:
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 12/21
12/10/23, 8:39 PM Ansible and How Does it Work
Features of Ansible
1. Agentless functioning
Ansible is an agentless system, which means it doesn’t install software on the
machines it controls. This eliminates possible faults and cyber threats while also
conserving server resources. Ansible is responsible for managing all master-agent
interactions. It does so by using either standard SSH or the Paramiko module, of
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 13/21
12/10/23, 8:39 PM Ansible and How Does it Work
which the latter is a Python implementation of SSH2. The tool does not need the
installation of agents on remote networks to be controlled, resulting in lower
maintenance costs and performance deterioration.
Ansible’s agentless usage is made possible via SSH and Windows Remote
Management. This sends micro, auto-generated modules to remote workstations
that “self-destruct” instead of running Unix commands. These modules deliver
JSON data and specify desirable states and organized procedures.
This highly efficient strategy can repurpose connections and requires very little
network traffic because of how activities are carried out. This strategy makes users
and the central management server more efficient with their resources and
eliminates all the problems that come with agent-based systems. For example,
“who will manage the management” is no longer an issue with Ansible. Non-root
access and a smaller attack surface are two other features that add to this
configuration’s desirability.
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 14/21
12/10/23, 8:39 PM Ansible and How Does it Work
modules extending the tool’s capabilities in any language as long as the data is in
JSON format.
SSH simplifies the entire setup procedure. Client information, such as hostnames,
IP addresses, and SSH ports, are saved in inventory files. Ansible may utilize an
inventory file once it has been built and filled. You can confirm how you can
interact with all inventory nodes over SSH with the identical username. Moreover,
if necessary, you can add your public SSH key to the authorized_keys file on those
systems. For running tasks against local Linux systems, Ansible uses SSH. To use
Ansible, you must set up the software’s SSH connection so that it can
automatically bypass a password request.
The central server initiates contact and delivers configuration information to the
nodes without requesting it in both circumstances. Because the central server
pushes the design to the nodes, you have greater control over which nodes need to
be set, the operations are more synchronous, and error management is much easier
because you can detect and solve errors immediately.
5. Ease of setup
Playbooks, roles, inventories, and variables files are organized by functions in the
setup feature, with tags at the play and task level for further specificity and control.
Although this is a robust and adaptable method, there are alternative options for
organizing Ansible data. Ansible makes it simple to complete tasks by automating
them and eliminating the need for manual deployment. It can configure systems,
install software, and organize more complex operations like continuous delivery
and zero downtime while rolling out new features, among other things.
See More: DevOps vs. Agile Methodology: Key Differences and Similarities
Takeaway
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 16/21
12/10/23, 8:39 PM Ansible and How Does it Work
Ansible is among the most popular technologies in the DevOps toolchain in 2022.
Indeed, OpenLogic’s 2022 State of Open Source Survey found that Ansible is one of
the top five DevOps tools for automation and orchestration, second only to Puppet.
Nearly one in four DevOps teams use the technology to automate the delivery of
software code, owing to its powerful yet free features. This 2013 launched DevOps
automation platform will remain popular worldwide even as new solutions
emerge.
Did this article help you understand what Ansible is and how it works? Tell us on
Facebook , Twitter , and LinkedIn . We’d love to hear from you!
MORE ON DEVOPS
Top 10 CI/CD Tools in 2022
Site Reliability Engineer: Job Description, Key Skills, and Salary in 2022
Automation DevOps
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 17/21
12/10/23, 8:39 PM Ansible and How Does it Work
Join Spiceworks to get the latest Tech News & Insights newsletter delivered to
your inbox!
Join Spiceworks
Chiradeep BasuMallick
Technical Writer
Do you still have questions? Head over to the Spiceworks Community to find
answers.
Take me to Community
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 18/21
12/10/23, 8:39 PM Ansible and How Does it Work
Popular Articles
Table of Contents
What Is Ansible?
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 19/21
12/10/23, 8:39 PM Ansible and How Does it Work
Recommended Reads
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 20/21
12/10/23, 8:39 PM Ansible and How Does it Work
Going To the Cloud for ECM? Prioritize AI’s Impact on Cloud-native at KubeCon
Benchmarking First! 2023
What Is WebAssembly (Wasm)? Working, AI: The Wakeup Call to Improve Open-
Uses, and Importance Source Software Security
https://www.spiceworks.com/tech/devops/articles/what-is-ansible/ 21/21