What is Ansible, how it works, and its use cases
By: Akhil Sukhnani
Tags: DevOps, Ansible, Cloud Computing, Technology, Automation

Ansible loves repetitive work, which people hate

What is Ansible?

Ansible is the simplest way to automate apps and IT infrastructure. Application Deployment + Configuration Management + Continuous Delivery. It is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment,intra-service orchestration, and many other IT needs.

It is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. It runs on many Unix-like systems and can configure both Unix-like systems as well as Microsoft Windows.

Designed for multi-tier deployments since day one, Ansible models your IT infrastructure by describing how all of your systems inter-relate, rather than just managing one system at a time.

It is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. It runs on many Unix-like systems and can configure both Unix-like systems as well as Microsoft Windows.

Some important terms related to Ansible:-

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 to facilitate sharing and reusing portions of provisioning. Roles let you automatically load related vars_files, tasks, handlers, and other Ansible artifacts based on a known file structure. Once you group your content in roles, you can easily reuse them and share them with other users.

: A pre-defined way for organizing playbooks and other files to facilitate sharing and reusing portions of provisioning. Roles let you automatically load related vars_files, tasks, handlers, and other Ansible artifacts based on a known file structure. Once you group your content in roles, you can easily reuse them and share them with other users. 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

EFFICIENT ARCHITECTURE

Ansible works by connecting to your nodes and pushing out small programs, called “Ansible modules” to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules (over SSH by default) and removes them when finished.

Your library of modules can reside on any machine, and there are no servers, daemons, or databases required. Typically you’ll work with your favorite terminal program, a text editor, and probably a version control system to keep track of changes to your content.

Ansible modules are reusable, standalone scripts that can be used by the Ansible API, or by the ansible or ansible-playbook programs. They return information to ansible by printing a JSON string to stdout before exiting. They take arguments in one of several ways which we’ll go into as we work through this tutorial.

Why should we use Ansible??

Ansible is the first human-readable automation language that can be read and written across IT. No matter what role you have in the organization, or how technical — Ansible gives you a common language to describe your IT infrastructure.

-> Its simple to use:-

Save time and be more productive

Eliminate repetitive tasks

Fewer mistakes & errors

Improve collaboration and job satisfaction

Overcome complexity

More resources for innovation

Increase accountability and compliance

Human readable automation

No special coding skills needed

Tasks executed in order

->Ansible is agentless, you don’t need any software packages to be installed at managed nodes

Uses OpenSSH and WinRM

No agents to exploit or update therefore providing enhanced security

Ansible provides Complete IT Automation

-> Provisioning

-> Configuration Management

-> Application Management

-> Continuous Delivery

-> Security Automation

-> Orchestration

Below are some real-world use cases solved by ansible:-

1.)FATMAP: INCREASING SPEED OF APPLICATION DEPLOYMENT WITH ANSIBLE

Fatmap is a technology-based company infrastructure: Windows, Linux, OS X which deals in Application Deployment, and the main problem they face is Time savings — Fatmap’s application development process was a complex one. Because they used 3D gaming technology to serve map content, the application build process involved a lengthy meta-programming pipeline and processing phase.

Fatmap’s application development process was a complex one. Because they used 3D gaming technology to serve map content, the application build process involved a lengthy meta-programming pipeline and processing phase. Fatmap required a solution that would speed and automate this time-consuming process. Additionally, their network environment was a heterogeneous one, utilizing a mixture of Windows, OS X, and Linux platforms, they needed a solution that would integrate seamlessly with existing machines

SOLUTION Ansible’s simple automation framework gives teams the power to deploy multi-tier applications quickly and reliably. Ansible models IT infrastructures by describing how all systems inter-relate, rather than just managing one system at a time. Using simple language in the form of Ansible Playbooks, allows users to describe their automation jobs in plain English which ensures easy adoption and use. Using Ansible, FATMAP has also increased the efficiency of the team by amalgamating its deployment best practices in one toolbox. And because Ansible’s agentless design integrates easily with a variety of networks, infrastructures, and operating systems (OS), it was easily introduced into FATMAP’s hybrid OS environment. RESULTS Using Ansible to automate application deployment, FATMAP has reduced complexity, realized significant time-savings, and achieved unparalleled scalability. Ansible solution benefits:

Faster time to deployment for data-rich applications

A predictable and simplified deployment process, creating deterministic outcomes and better utilization of team resources

Improved integration of disparate machines and seamless automation of critical tasks across services and application

NASA USE CASE:-

NASA needed to move roughly 65 applications from a traditional hardware-based data center to a cloud-based environment for better agility and cost savings. The rapid timeline resulted in many applications being migrated ‘as-is’ to a cloud environment. This created an environment spanning multiple virtual private clouds (VPCs) and AWS accounts that could not be easily managed. Even simple things, like ensuring every system administrator had access to every server, or simple patching, were extremely burdensome.

SOLUTION:- Leverage Ansible Tower to manage and schedule the cloud environment RESULTS As a result of implementing Ansible Tower, NASA is better equipped to manage its AWS environment. Tower allowed NASA to provide better operations and security to its clients. It has also increased efficiency as a team. By the numbers:

* Updating nasa.gov went from over 1 hour to under 5 minutes

* Patching updates went from a multi-day process to 45 minutes

* Achieving near real-time RAM and disk monitoring (accomplished without agents)

* Provisioning OS Accounts across the entire environment in under 10 minutes

* Baselining standard AMIs went from 1 hour of manual configuration to becoming an invisible and seamless background process

* Application stack set up from 1–2 hours to under 10 minutes per stack.

Thanks for reading, I hope you found this article informative.