What is Ansible?
If you are a system administrator or IT engineer you probably involved in doing a lot of repetitive task in your environment whether it be sizing, creating a new house or virtual machines every day, applying configuration on them, patching hundreds of servers, migration or even performing security and compliance audits. All of these very repetitive tasks involve the execution of hundreds of commands on hundreds of different servers. Smart people develop a script to automate these tasks but it requires coding skills and regular maintenance of this script and a lot of time to put this script together in the first place. That’s where the Ansible comes in the picture.
Ansible is a powerful IT automation tool that you can quickly learn. It’s simple enough for everyone in IT yet powerful enough to automate even the most complex deployment.
Simple — Use Case Example
Let’s take a look at a simple use case shown in the following screen.
Imagine you have a number of servers in your environment that you would like to restart in a particular order. Some of them are web servers and others are database servers. So you would like to power down the webserver first followed by the database servers then powerup the database servers and then webservers. You could write an Ansible playbook to get this done in a minute and simply invoke the Ansible playbook every time you wish to restart your applications.
Complex — Use Case Example
Let’s take a look at a complex use case as shown in the following screen:
In this case, we are setting up a complex infrastructure that spans across public and private clouds, and hundreds of VMs. With Ansible you could provision VMs on a public cloud like AWS and provision private cloud in private cloud setup like Vmware based infrastructure and move on to configuring applications on those systems and setup communication between them. There are a lot of modules available in Ansible that support this kind of operation.
One of the main features of Ansible is that you don’t need to install any agent or additional software on the target host. It provides powerful features to manage operating systems, services, networks and infrastructure.
Some of the important features of Ansible are listed below:
- Free : It is an open-source tool and is available to the users for free of cost.
- Agentless : It is agentless that means it does not need any tool on the target host for automation.
- Simple : It is very simple and easy to use tool. You don’t require any coding skills to use Ansible.
- Powerful : It is a very powerful tool that helps you to build a highly complex infrastructure of the IT industry efficiently.
- Extensible : It provides a lot of extensions that help to automate your every need.
How Ansible Works?
Ansible consists of 3 main components. A brief explanation of each component is shown below:
Control Machine : It manages the execution of the Playbook. It can be installed on your local machine or on any machine on the internet.
Inventory : It provides a complete list of all the target machines on which various modules are run by doing an ssh connection and install the necessary software.
Playbook : It consists of steps that the control mechanism will perform on the servers defined in the inventory file.
In simple terms, Ansible interacts with all the servers defined in the inventory through the SSH protocol which is a secure method of remote login. Every operation is done and file transfer is encrypted.
For more information, read my complete guide on Ansible for Beginners