Ansible, an open-source IT Configuration Management, Deployment & Orchestration tool. It aims to provide significant productivity gains to a wide variety of automation challenges. This tool is straightforward to use yet powerful enough to automate complex multi-tier IT application environments.
Why Do We Need Ansible?
It is of utmost importance to understand problems that were faced before Ansible.
Previously, system administrators managed servers by hand, changing configurations, installing software, and administering services on individual servers.
Data centers grew, and hosted applications became complex, administrators realized they could not scale manual systems management as fast as the applications they were enabling. It hampered the developers’ velocity since the development team was agile and releasing software frequently. Still, IT operations were spending time configuring the systems.
That is why server provisioning and configuration management tools came to grow. Consider the busy routine of administering a server fleet. We always need to keep pushing changes, updating, copying files on them, etc. These tasks make things very complicated and time-consuming.
Before explaining to you all about Ansible, let’s get you familiarized with Ansible terminologies.
- Controller Machine: The machine on which Ansible is installed is responsible for running the provisioning on the servers you are managing.
- Inventory: An initialization file that consists of information about the servers that we are managing.
- Playbook: It is an entry point for Ansible provisioning, where tasks with YAML format define the automation.
- Task: Defines a single procedure to be executed to install a package.
- A module abstracts a system task, such as dealing with packages, creating or changing files. Ansible has a multitude of built-in modules to create custom ones.
- Role: A pre-defined way to organize playbooks and other files to facilitate sharing and reusing portions of provisioning.
- Play: A provisioning executed from very start to finish is called a match. In simple words, the execution of a playbook is called a game.
- Facts: Global variables that contain information about the system, such as network interfaces or operating system.
- Handlers: To trigger service status changes, i.e., restarting or stopping a service.
- Simple: It uses a simple syntax written in YAML called playbooks. YAML is a human-readable, data serialization language. It is extraordinarily simple. No special coding skills are required. People, even in your IT organization, who do not know what Ansible is, can likely read a playbook and understand what is happening. Ansible always executes tasks in order. It is simple to install, too. The simplicity makes sure that you can get started quickly.
- Agentless: Finally, Ansible is entirely agentless. There are no agents or any software or additional firewall ports that you need to install on the client systems or hosts you want to automate. You do not have to set up a management infrastructure separately, which includes managing your entire operations, network, and storage. Ansible reduces the effort required for the team to start automating right away.
- Powerful & Flexible: Ansible’s powerful features that can enable to model even the most complex IT workflows. In this aspect, Ansible’s batteries included approach can manage the infrastructure, networks, operating systems, and services that you are already using, as Ansible provides with hundreds of modules to manage them. Together Ansible’s capabilities orchestrate the entire application environment regardless of where it is deployed.
- Efficient: No extra software on the servers means more resources for applications. As Ansible modules work via JSON, Ansible is extensible with modules are written in a programming language already known. Ansible introduces modules as essential building blocks for the software. We can even customize it as per our needs.
What Can Ansible Do?
Ansible is generally grouped along with other Configuration Management tools like Puppet, Chef, SaltStack, etc. Ansible is not limited to Configuration Management but can also be used in many different ways.
Provisioning: The apps have to live somewhere. If you have PXE (Preboot eXecution Environment) booting and kick-starting bare-metal servers and Virtual Machines, or cloud instances from templates, or creating virtual or Ansible & Ansible Tower is there for the help to streamline this process. In case we want to test the debug version of an application that is built with Visual C++, we ought to meet some prerequisite requirements like having Visual C++ library DLLs (msvcr100d.dll). We will also need Visual Studio installed on our computer. This is when Ansible makes sure that the required packages are downloaded and installed to provision the application.
Configuration Management: It maintains and establishes consistency of the product performance by recording and updating detailed information that describes hardware and software better. It includes the updates and versions that have been applied to installed software packages and the locations and network addresses of hardware devices. If we want to install the new version of Tomcat on all of the machines present in your enterprise, it is not feasible for us to manually go and update each device. We can install Tomcat in one go on all of the machines with Ansible playbooks and inventory are written most straightforwardly.
Application Deployment: When defining our application with Ansible and manage to deploy with Ansible Tower, teams can effectively manage the entire application life cycle from development to production.
Orchestration: Configurations alone don’t define your environment. You need to determine how multiple configurations interact and ensure the disparate pieces can be managed. Out of complexity and chaos, Ansible brings order.
Ansible provides Orchestration to align the business request with the applications, data, and infrastructure. It defines the policies and service levels through automated workflows, provisioning, and change management. This creates an application-aligned foundation that can be scaled up or down based on the needs of each application.
Consider the situation where we want to deploy a new website in place of the existing one. For that, we will remove the current site, and implement our new website, and restart the load balancer or the web cluster if needed. Users would notice downtime because we have not removed traffic going live to the said machines via the load balancer. So, we require some pre-task, where we tell the load balancer to put this webserver into maintenance mode so that we might disable traffic temporarily from going to it, as it gets upgraded. We added a block up here, which means a pre-task will be to disable the web node in the load balancer.
So, this is the pre-task, where we can disable traffic, then down here, we can upgrade the node using these various tasks. Finally, we require some type of post-task, which will enable traffic to the web node again by taking it out of maintenance mode. These tasks might be written in Ansible playbooks, and hence it helps to orchestrate the environment.