The Subtle Art of Ansible Automation

Devashish jain
5 min readDec 1, 2020

In this article we will see What is Ansible and how industries are solving different challenges using it.

Why Ansible?

Three main reason to use ansible :

1) IT Automation

2) Consistent Configuration Management

3) The ability to automatically deploy new software to new server or even rebuild existing servers.

Eh! that’s too direct! Let’s take a scenario in consideration.

Raj is system administrator in a start-up and he is responsible for maintaining the infrastructure of all the servers within his company. His job is that he has to maintain and manage web servers running over Apache, database servers running mySQL. Initially he had to maintain only a few servers, which he could manage individually manually. But now as the company grew, a sudden requirement came up for maintaining hundreds of servers, also the services.

It become increasingly difficult to create a consistent setup of different infrastructures like web server, databases. There’s a good chance that Raj may not set up each server identically. He goes to her boss, Simran, and tells about this problem. She tells him about ANSIBLE and helps Raj in becoming an efficient operational team.

Ansible like other system solutions such as chef and puppet uses code that you can write and describe the installation and set up all the service so that you can repeat it and deploy those servers consistently into multiple areas.

So now Raj don’t have to redoing and brief following setup procedure. He just have to write one script and then each script can be executed and have a consistent environment.

What is ansible?

Ansible is a software tool that provides simple but powerful automation for cross-platform computer support. It is primarily intended for IT professionals, who use it for application deployment, updates on workstations and servers, cloud provisioning, configuration management, intra-service orchestration, and nearly anything a systems administrator does on a weekly or daily basis.

Ansible doesn’t depend on agent software and has no additional security infrastructure, so it’s easy to deploy. The bottom line is you would be able to speed up and make operations team more efficient with ansible.

How Ansible works

In Ansible, there are two categories of computers: the control node and managed nodes. The control node is a computer that runs Ansible. There must be at least one control node, although a backup control node may also exist. A managed node is any device being managed by the control node.

Ansible works by connecting to nodes (clients, servers, or whatever you’re configuring) on a network, and then sending a small program called an Ansible module to that node. Ansible executes these modules over SSH and removes them when finished. The only requirement for this interaction is that your Ansible control node has login access to the managed nodes. SSH keys are the most common way to provide access, but other forms of authentication are also supported. Ansible is an intelligent tool that uses RAL (Resource Abstraction Layer) to use a common set of commands to deploy packages and actions in various OS without having to tell the exact commands or the OS.

Ansible playbooks

While modules provide the means of accomplishing a task, the way you use them is through an Ansible playbook. A playbook is a configuration file written in YAML that provides instructions for what needs to be done in order to bring a managed node into the desired state.

Playbooks are meant to be simple, human-readable, and self-documenting. They are also idempotent, meaning that a playbook can be run on a system at any time without having a negative effect upon it. If a playbook is run on a system that’s already properly configured and in its desired state, then that system should still be properly configured after a playbook runs. The approach to write the commands in Ansible is to first make a goal of what to achieve, write the step-by-step procedure and then convert the steps into commands supported by Ansible.

Use case by Hootsuite

Hootsuite is a social-media management system. They are able to help with you managing your pushes of social media content across all of the popular social media platforms. They’re able to provide analytics, tools that marketing and sales teams can use to be able to assess a sentiment analysis of the messages that are being pushes out.

But a part of their popularity drove a specific problem straight to Hootsuite. The chance they had at HootSuite is that they had to constantly go back and rebuild their server environment and they couldn’t do this continuously and be consistent there was no standard documentation and the entire process relied on memory. This become very complex as scaling of popular product had now hundreds of thousands of users. This is where ansible came in and helped the folks over at hoot suite.

Now the DevOPS team at HootSuite write playbook that have specific instructions that define the architecture and structure of their hardware nose and environment and they are able to do that as a standard product instead of it being problem in scaling up their environment they now are able to rebuild and create new servers in a matter of seconds!

Ansible has able to provide HootSuite with IT automation, consistent configuration and free up time from operations teams so that instead of managing servers, they’re able to provide additional value to the company.

--

--