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


FAQs On Ansible
1. What is Copy Module in Ansible?
The “copy” module in Ansible is used to copy files and directories from the local system (the machine where Ansible is run) to remote target hosts.
2. What is Ansible Ping Command?
Ansible ping command is basically used to ping the or check the reachability of the remote host machines.
3. What is Ansible vs Jenkins?
Ansible is an configuration management or automation tool and jenkins is an tool used for CI/CD (Continuous Integration and Continuous Delivery (or Continuous Deployment)
4. What Language is Ansible In?
Ansible is primarily written in Python. Ansible playbooks are written in the YAML (Yet Another Markup Language).
Similar Reads
Linux/Unix Tutorial
Linux is a widely-used open-source operating system, similar to Windows, Mac, and Android. It shares similarities with Unix, another operating system known for its commercial use. Unix and Linux have comparable components, including the kernel, shell, and programs. Many commands in Unix and Linux ex
12 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
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
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
How to build a Linux server on a Raspberry Pi from Windows?
The Raspberry Pi is a small, inexpensive computer that is of the size of a credit card that connects to a computer monitor or TV and operates with a regular keyboard and mouse. With the help of this competent small gadget, individuals of all ages may learn about computing and how to program in langu
6 min read
How To Make Money With Online Tutoring
Teaching is a noble profession where young minds are trained in a specific domain or subject. These days, teaching pupils has become a lot easier with the advent of virtual education and unified communication platforms. Even if you are a student pursuing a professional curriculum, you can earn by te
8 min read
How to use ChatGPT to Create Tutorial Guides
Using ChatGPT to create tutorial guides blends AI capabilities with human intelligence in a smooth process. Through the use of ChatGPT's extensive knowledge base and language comprehension, users can create in-depth tutorials on any subject easily. Users first define the topic and create a collectio
8 min read
COBOL - Installing COBOL
There are three things that interested software developers always need when learning a new programming language: a desire to learn, a few good books on said programming language as well as a decent IDE to master the basics. If youâre a Computer Science student who has had to program in both Java and
5 min read
7 Tips and Tricks to Learn Programming Faster
One of the common and basic questions among students or someone who wants to learn code is "How can I learn to code fast and make a career as a programmer?". Whether you are a student, fresher or experienced person trying to switch your job in programming you will definitely try to find tips and tri
7 min read
Learn Java - A Beginners Guide for 2024
If you are new to the world of coding and want to start your coding journey with Java, then this learn Java a beginners guide gives you a complete overview of how to start Java programming. Java is among the most popular and widely used programming languages and platforms. A platform is an environme
10 min read