How Industries Are Using Ansible To Solve Their Use-Cases
By: Niket Ranjan
Tags: Ansible Tower, Ansible, Ansible Playbook, Righteducation

Ansible is an open-source IT Configuration Management, Deployment & Orchestration tool. It aims to provide large productivity gains to a wide variety of automation challenges. This tool is very simple to use yet powerful enough to automate complex multi-tier IT application environments.

You can use Ansible to automate three types of tasks:

Provisioning: Applications have to be deployed or installed on systems. Ansible and Red Hat Ansible Tower can help streamline the process of provisioning systems, whether you are PXE booting and kickstarting bare-metal servers or virtual machines, or creating virtual machines or cloud instances from templates.

Configuration management: Change the configuration of an application, OS, or device; start and stop services; install or update applications; implement a security policy; or perform a wide variety of other configuration tasks.

Application deployment: When you define your application with Ansible and manage the deployment with Red Hat Ansible Tower, teams can effectively manage the entire application life cycle from development to production.

Why Do We Need Ansible?

The server systems are the underlying foundation of our applications and thus, like our applications, they should be version controlled, tested, and automated. As such we looked for a configuration management tool that could solve our automation needs. We started looking at products like Puppet and Chef. Puppet’s complexity was overwhelming and Chef’s architecture didn’t quite meet our use case. We needed to find something that worked well, didn’t take a lot of time to learn, could easily be version controlled, and didn’t require additional infrastructure. After some research, we came across Ansible.

Configuration management tools are not new, they have been around for some time, but their complexity always made their adoption a difficult process. This is where Ansible truly shines, it has lowered the learning curve enough so that it is easier to use Ansible than to do manual stuff or shell scripting, even for a local install and configuration.

We now use Ansible for any task or project that requires repeatable processes and a consistent environment, such as provisioning IoT devices and server infrastructure, installation and configuration of applications, and application deployment.

Ansible Terminologies:

Controller Machine : The machine where Ansible is installed, responsible for running the provisioning on the servers you are managing.

: The machine where Ansible is installed, responsible for running the provisioning on the servers you are managing. Inventory : An initialization file that contains information about the servers you are managing.

: An initialization file that contains information about the servers you are managing. Playbook : The entry point for Ansible provisioning, where the automation is defined through tasks using YAML format.

: 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.

: 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.

: 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 provisioning.

: A pre-defined way for organizing playbooks and other files in order to facilitate sharing and reusing portions of provisioning. Play : A provisioning executed from start to finish is called a play. In simple words, the execution of a playbook is called a play.

: A provisioning executed from start to finish is called a play. In simple words, the execution of a playbook is called a play. Facts : Global variables containing information about the system, like network interfaces or operating system.

: 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.

Features of Ansible

Simple: Ansible Playbooks provide human-readable automation. This means that playbooks are automation tools that are also easy for humans to read, comprehend, and change. No special coding skills are required to write to them.

Ansible Playbooks provide human-readable automation. This means that playbooks are automation tools that are also easy for humans to read, comprehend, and change. No special coding skills are required to write to them. Powerful: You can use Ansible to deploy applications, for configuration management, workflow automation, and network automation. Ansible can be used to orchestrate the entire application life cycle.

You can use Ansible to deploy applications, for configuration management, workflow automation, and network automation. Ansible can be used to orchestrate the entire application life cycle. Agentless: Ansible is built around an agentless architecture. Ansible connects to the hosts it manages using OpenSSH or WinRM and runs tasks by pushing out small programs called Ansible modules to those hosts.

Ansible Architecture

Control Node: A control node is a system where Ansible is installed and set up to connect to your server. You can have multiple control nodes.

A control node is a system where Ansible is installed and set up to connect to your server. You can have multiple control nodes. Managed Node: The systems you control using Ansible are called managed nodes. Ansible requires that managed nodes are reachable via SSH and have Python 2 (version 2.6 or higher) or Python 3 (version 3.5 or higher) installed.

The systems you control using Ansible are called managed nodes. Ansible requires that managed nodes are reachable via SSH and have Python 2 (version 2.6 or higher) or Python 3 (version 3.5 or higher) installed. Modules: Ansible works by connecting to your nodes and pushing out scripts called “Ansible Modules” to them. Most modules accept parameters that describe the desired state of the system. Ansible then executes these modules (over SSH by default) and removes them when finished.

Ansible works by connecting to your nodes and pushing out scripts called “Ansible Modules” to them. Most modules accept parameters that describe the desired state of the system. Ansible then executes these modules (over SSH by default) and removes them when finished. Plugins: Plugins augment Ansible’s core functionality. While modules execute on the target system in separate processes, plugins execute on the control node within the /usr/bin/ansible process. Plugins offer options and extensions for the core features of Ansible.

Plugins augment Ansible’s core functionality. While modules execute on the target system in separate processes, plugins execute on the control node within the /usr/bin/ansible process. Plugins offer options and extensions for the core features of Ansible. Inventory: An inventory file contains a list of the hosts you’ll manage using Ansible. Although Ansible typically creates a default inventory file when installed, you can use per-project inventories to have a better separation of your infrastructure.

An inventory file contains a list of the hosts you’ll manage using Ansible. Although Ansible typically creates a default inventory file when installed, you can use per-project inventories to have a better separation of your infrastructure. Playbook: A playbook contains an ordered list of tasks, and a few other directives to indicate which hosts are the target of that automation, Ansible executes tasks sequentially, and a full playbook execution is called a play. Playbooks are written in YAML format.

A playbook contains an ordered list of tasks, and a few other directives to indicate which hosts are the target of that automation, Ansible executes tasks sequentially, and a full playbook execution is called a play. Playbooks are written in YAML format. APIs: APIs in Ansible are used as transport for Cloud services, public or private.

What is Ansible Tower?

Ansible Tower is Ansible at a more enterprise level. It is a web-based solution for managing your organization with a very easy user interface that provides a dashboard with all of the state summaries of all the hosts, allows quick deployments, and monitors all configurations.

The tower allows you to share the SSH credentials without exposing them, logs all the jobs, manage inventories graphically, and syncs them with a wide variety of cloud providers.

How companies use Ansible?

The ongoing digital transformation coupled with the growing popularity of cloud means companies are now more dependent on dynamic, all-in-one tools that can solve multiple problems across a host of platforms.

Further, today’s organizations are looking for ways to ease into automation while also striving toward higher levels of customer satisfaction. For many organizations, the open-source platform Ansible is the answer to these modern-day challenges. Here are a few examples of companies successfully implementing an Ansible migration.

Some of the companies benefitting from the use of Ansible are:-

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 was 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.”

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 the 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,”.

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 application 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.