Ansible is an open-source IT engine that automates application deployment, cloud provisioning, intra-service orchestration, and other IT tools. It is an automation and orchestration tool popular for the following reasons:
- Simple to Install.
- Free and open source.
- Lightweight and consistent.
- OpenSSH security features make it very secure.
What Is Ansible?
Ansible can be used to deploy the software on different servers at a time without human interaction. Ansible can also be used to configure the servers and create user accounts. Ansible is an agent-less software which means there is no need to install the software in the nodes which means you need to do the SSH to connect the nodes to perform the required operations on the servers.
Ansible playbooks can be written very easily they will be like plain english and Ansible is developed using Python language. There is no need for any knowledge of programming. A single ansible control node can manage thousands of the nodes.
Ansible Architecture
- Control node: Commands and Playbooks can run by invoking /usr/bin/ansible or /usr/bin/ansible-playbook, from any control node. You can use any computer that has Python installed on it as a control node. However, one can not use a computer with Windows OS as a control node. One can have multiple control nodes.
- Managed nodes: Also sometimes called "hosts", Managed nodes are the network devices (and/or servers) you manage with Ansible.
- Inventory: Also sometimes called "hostfile", Inventory is the list of Managed nodes use to organize them. It is also used for creating and nesting groups for easier scaling.
- Modules: These are the units of code executed by Ansible. Each module can be used for a specific purpose. One can invoke a single module with a task, or invoke several different modules in a playbook.
- Tasks: The units of action in Ansible. One can execute a single task once with an ad-hoc command.

Ansible Playbook With Example
These are the ordered list of tasks that are saved so you can run those tasks in that order repeatedly. Playbooks are written in YAML and are easy to read, write, share and understand.Ansible playbooks can perform wide variety of tasks as mentioned below
- Deploying and configuring applications
- Managing system configurations
- Orchestrating complex workflows
Example
The language used to write the ansible playbooks was YAML which is human redable.Following sections will consists in ansible playbook.
---
- hosts: all
tasks:
- name: Install the Apache web server
apt:
name: apache2
state: present
- Hosts: Host in ansible play book defines no.of remote host that playbook will executed and performs the task specified.
- Vars: Vars in anisble playbook defines the variables which can be used through out the playbook.
- Tasks: This is the section where we are going tot mention the type of task to be executed in the host servers.
Ansible Tower
Ansible tower provides web-based user interface to manage the playbooks which are used to configuring the software's. Ansible tower will acts as an medium to manage and execute the task like playbooks and adding the new host to the ansible. following are the some features available in the ansible tower.
- Security: Ansible tower provides the Role-based access control (RBAC) which can be used to manage the access of users and can assign permissions to the playbooks and other resources. You can make sure the which user should which type permissions to access the resources in the ansible tower.
- Job scheduling: Ansible tower provide the option for scheduling the jobs to execute which will execute automatically in the interval's of time This can help to automate tasks such as daily backups or weekly system updates.
Ansible Modules
Ansible modules are scripts which can be reused and performs the tasks which have mentioned init in the host servers on behalf of you. Instead of performing the installation of softwares manually on each server ansible will automate the process. The tasks which you want to perform can be done on multiple OS also as mentioned following.
- Linux
- Windows
- macOS)
The module which you are going to use will be written in the python. And the modules typically stored in central location which is like git repository they can be reused and shared with others.
Types of Ansible Modules
Following are the some modules which are frequently used in the ansible.
- System modules
- Application modules
- Cloud modules
- Networking modules
- Command modules
Ansible Roles
Ansible material can be arranged and reused using Ansible roles. They usually include a collection of variables, handlers, tasks, and templates used to carry out a particular activity, like setting up an application or installing and configuring a web server.Ansible playbooks can be made more modular and reusable by using roles. To deploy many web apps, you could, for instance, build a role for installing and configuring the Apache web server and then utilise that role repeatedly in different playbooks.Sharing Ansible material with other people is another way to use roles. To make your roles available for usage in other people's playbooks, you can publish them to Ansible Galaxy, a public repository for Ansible roles.
Ansible vs Terraform
|
Declerative approach it cares about current and end state of the system after executing playbook.
| Declerative approach it cares about current and end state of the system after executing script file.
|
It doesn't maintain type of statefile to track the task performed in the host servers.
| Maintain the statefile and before executing any task it will cross verify with that statefile.
|
Playbooks for a variety of use cases are simple to find and distribute because to Ansible's huge community and large library of pre-built modules.
| Terraform is a great option for infrastructure provisioning and administration because of its huge ecosystem of providers for various cloud platforms and services.
|
Flexible, powerful, and easy to use.
| Scalable, efficient, and secure.
|
Ansible Installation
In order to install ansible, the system must have python preinstalled.
Open up Terminal and execute the following commands.:
1. Add the Ansible Repository.
sudo apt-add-repository -y ppa:ansible/ansible

2. Update the system repository listings.
sudo apt-get update

3. Install the ansible packages.
sudo apt-get install -y ansible

Similar Reads
Devops and Linux Tutorial DevOps combines software development (Dev) and operations (Ops) to speed up software delivery and enhance collaboration. It uses automation and streamlined processes to build, test, and deploy software more reliably and efficiently. Before starting with DevOps, learning Linux and Git is essential. L
4 min read
Linux/Unix Tutorial Linux is one of the most widely used open-source operating systems. It's fast, secure, stable, and powers everything from smartphones and servers to cloud platforms and IoT devices. Linux is especially popular among developers, system administrators, and DevOps professionals.Linux is:A Unix-like OS
10 min read
Steps to Build a Typical Linux Project Linux is an operating system just like Windows and Unix. Meanwhile, Linux is an open-source project which keeps it different from other operating systems. There is a misconception in the developer community thinking that Linux is the tough part to handle that a normal person can't use it. In reality
4 min read
Bandit - A Wargame For Linux Beginners The Bandit is a wargame for those who are beginners at Linux/UNIX environment and are facing problems while learning the real-time use of Linux commands. The game will teach the basics of Linux and will make you compatible to play even other wargames. This game basically provides you the environment
2 min read
How to Use Ansible Documentation for Effective Learning Ansible is an open-source automation tool that allows for effective IT infrastructure management through configuration management, application deployment, and orchestration. User-defined desired states for systems are defined in very human-readable text with Ansible using a very powerful and versati
9 min read
10 Best Linux Project Ideas For Beginners Linux is a famous operating system that looks complicated at first, but there are a few ways to master it. According to the statistics, more than 45% of professional developers work on Linux. That's why developing your skills in Linux can be a good option. As a Linux geek, you can get your hands on
7 min read
30 Days of Linux : A Complete Guide For Beginners Ever thought of learning the Linux Operating System? Why do software and network engineers love Linux? why Linux is different from others. Well, why don't you find yourself? In the next 30 days, you will learn Linux OS from scratch. Let's get started. In the world of operating systems, Linux stands
6 min read
What Is An Ansible Playbook And How To Write One On Your Own Ansible empowers you to perform all of these tasks by using playbooks which help to write instructions in files. Let's imagine the playbook to be similar to a recipe book, except from following the steps on a dish, the computers will be getting those one-step-at-a-time instructions. Each playbook is
12 min read
Google Cloud Platform - Introduction to Qwiklabs Qwiklabs provides lab learning environments that help developers and IT professionals get hands-on experience working with leading cloud platforms and software. Qwiklabs provides temporary credentials to Google Cloud Platform and Amazon Web Services so that you can get a real-life experience by work
3 min read
25 Basic Linux Commands For Beginners [2025] While performing a task, we all need shortcuts. Shortcuts help us to complete a task quickly. Linux comes with such commands which are one to two words, using that commands, you can perform several operations in no time. As a beginner, you must be aware of those basic Linux commands to complete an o
13 min read