AUTOMATION WITH ANSIBLE

Niharika Dhanik
6 min readDec 1, 2020
Ansible

What is Ansible?

Ansible is an open source automation engine designed for Information technology (IT) administrators and development and operations (DevOps) teams. It is a tool in the Server Configuration and Automation category of a tech stack. It is an IT automation tool.

Why Ansible?

Ansible enables users to automate software provisioning, configuration management, and application deployment, model IT infrastructure by describing system interrelations, run tasks in sequence and create a chain of events on several different servers or devices.

It can configure systems, deploy software, and orchestrate more advanced IT tasks such as continuous deployments or zero downtime rolling updates.

Features include state-driven resource model, security and compliance, container management, network devices management, and remote configuration management. Ansible’s goals are foremost those of simplicity and maximum ease of use.

What is Configuration Management?

Ansible Automation and configuration management are indispensable to an efficient DevOps-driven environment. Configuration management is a process for maintaining computer systems, servers, and software in a desired, consistent state. Configuration management keeps you from making small or large changes that go undocumented. These misconfigurations can lead to poor performance, inconsistencies, or noncompliance and negatively impact business operations and security. When undocumented changes are made across many systems and applications, it adds to instability and downtime.

Ansible Terms

  • Controller Node : The machine where Ansible is installed, responsible for running the provisioning on the servers you are managing.
  • Target/Manage Node : The machine that will be monitored and connected to the Controller Node for automation and purposes.
  • Inventory: An initialization file that contains information about the servers you are managing. It is basically a file containing a list of all the target / manage nodes.
  • Playbook: The entry point for Ansible provisioning, where the automation is defined through tasks using YAML format.
  • Task: A block that defines a single procedure to be executed, e.g. Install a package.
  • Module: A module typically abstracts a system task, like dealing with packages or creating and changing files. Ansible has a multitude of built-in modules, but you can also create custom ones.
  • Role: A pre-defined way for organizing playbooks and other files in order to facilitate sharing and reusing portions of a provisioning.
  • Play: A provisioning executed from start to finish is called a play. In simple words, execution of a playbook is called a play.
  • Facts: Global variables containing information about the system, like network interfaces or operating system.
  • Handlers: Used to trigger service status changes, like restarting or stopping a service.

Getting started with Ansible

The installation of Ansible has to be done on Controller Node No other client software is installed on the node machines. It uses SSH to connect to the nodes. Ansible only needs to be installed on the control machine (the machine from which you will be running commands) which can even be your laptop. It is a simple solution to a complicated problem.

Ansible requires nothing more than a password or SSH key in order to start managing systems and can start managing them without installing any agent software, avoiding the problem of "managing the management" common in many automation systems. There’s no more wondering why configuration management daemons are down, when to upgrade management agents, or when to patch security vulnerabilities in those agents.

Docker, Amazon EC2, Kubernetes, New Relic, and Microsoft Azure are some of the popular tools that integrate with Ansible.

Examples

Here are a few examples of companies successfully implementing an Ansible migration.

  1. HOOTSUITE

Hootsuite is a social media management system used by businesses and organizations. It allows the execution of social media campaigns on a variety of networks from a secure dashboard. Hootsuite is popular among Fortune 1000 companies.

The main challenge facing Hootsuite was the lack of repeatability. This made automating Hootsuite’s infrastructure a challenge, and Hootsuite were also facing difficulties in application deployment.

To resolve this, Hootsuite introduced Ansible core. This allowed Hootsuite to build servers from scratch and enabled repeatability. In the future, Hootsuite plans to implement an Ansible migration of its app deployment and possibly in ad hoc production server management.

Since performing their Ansible migration, Hootsuite says ops and devs ‘feel safer’. Additionally, Ansible allows developers to repeatedly test server builds on a local level until the team can be sure they work.

Hootsuite intends to use Ansible in many other ways, and as Beier Cai, Director of Technology, Hootsuite Media Inc., explains, “In the beginning I didn’t realize Ansible is good for orchestration as well but found it out quickly and I really loved it as it beats competitors right there.”

2. AMELCO

Amelco is a UK-based company that develops software solutions for the betting industry and financial betting markets. The business was looking for a way to deploy its applications efficiently across its hundreds of different environments, and it also sought to limit downtime. To do this, Amelco performed an Ansible migration to an agentless automation framework. This reduced the complexities it faced with the deployment, operations and the upgrade of applications over a range of contrasting locations, while also using one simplified language.

In addition, by introducing Ansible and Ansible Tower, Amelco has successfully automated its application deployments. Other benefits include reduced complexity and continuous delivery, along with speed solution delivery.

Further benefits include:

“Faster time to deployment for its bespoke and modular client solutions, resulting in speedier time to market and higher customer satisfaction”.

“A simplified and repeatable deployment process, leveraging true multi-tier, multi-step orchestration that minimized the complex dependencies of heterogeneous environments,”.

3. LIFESUM

Based in Stockholm, Lifesum is a digital health platform that encourages users to lead a healthier, more balanced lifestyle. Lifesum has proved hugely successful throughout Europe, reaching over 6 million downloads so far.

Lifesum’s platform uses a host of applications, in addition to a joint back end API, and it bases its infrastructure on AWS. Lifesum was looking for a simplified yet robust tool to allow configuration management, application deployment, and server provisioning.

Prior to introducing Ansible, Lifesum had used another tool but found provisioning and managing different environments a challenge.

Lifesum started their Ansible migration in 2014. It started implementing Ansible straight away and has used it in several major areas. First, Lifesum used Ansible playbooks “to automatically spin up virtual development machines with Vagrant”.

In the case study, Michal Gasek, SYSOPS Engineer/DBA at Lifesum also notes that Lifesum’s goal, “[is] to ensure that everyone had exactly the same working environment as we deploy our applications regularly. Three months later all our environments, from developer’s laptops to production instances on Amazon, [are] fully Ansible managed.”

Gasek continues, “We use AWS Auto Scaling and pre-bake Amazon AMI images with Ansible provisioning playbooks. When EC2 instances are launched by Auto Scaling, Ansible, triggered by cloud-init, runs provisioning playbooks, once again ensuring up-to-date configuration changes are applied, and pulling the latest applications versions from repositories. Ansible has helped us to automate, significantly simplify and speed up the process of dynamic resources scaling”.

Gasek adds that Ansible stood out because of its ‘power and simplicity’. Gasek also highlights how Ansible has enabled developers to concentrate on building ‘great product features’, rather than solving common problems like inconsistencies and misconfiguration.

Conclusion

With today’s demand for automation, consistency and the move towards cloud, companies from all sectors are adopting easy-to-use tools that enable them to achieve these goals and overcome complexities. These three success stories show how an Ansible migration is the ideal solution for automating organizations’ modern technology challenges, while also performing an essential role in app deployment and improving responsiveness.

--

--