CHAPTER 1
Ansible is an open-source software, automation engine, and automation language mainly used in software configuration management, infrastructure provisioning, configuration management, application deployment, and orchestration. The Ansible automation engine executes Ansible playbooks.
The main qualities of Ansible are:
Ansible, initially created in 2012, was acquired by Red Hat in 2015.
As a software developer or system administrator, you are aware of how challenging it is to keep the application deployment and server’s management efficient and reliable.
System administrators at one point in time managed servers by hand (and this is sometimes still the case). This obviously included installing the operating system and keeping it up to date, installing the software needed for the application to run, changing configuration for application deployment, and a myriad of other tasks.
Given the fact that we live in an information age, and that the usage of the typical applications, now internet-facing, has grown to an unthinkable size, manual system management simply doesn’t work anymore.
Application development, now being very agile, has become quicker, as the time to market is one of the key factors (as it has always been!). Software releases have become more frequent, and scalability and elasticity of the applications are requiring an effort that can no longer be managed manually.
In simple terms: everything is more complex, bigger, and faster!
This is why configuration management tools such as Ansible, Puppet, Chef, and SaltStack came to thrive as solutions to the problems I just mentioned.
Ansible has a wide range of usages, covered in the following sections.
Infrastructure provisioning is the process of setting up the IT infrastructures, which refers to the components, hardware, and software needed to operate an application service or system. Bear in mind that provisioning is not the same as configuration, but both are steps in the deployment process.
Infrastructure as code (IaC) is a term that describes the ability to script and code the infrastructure, as we would do for other kinds of software. This obviously has the great benefit of being traceable, versioned, and rolled back if necessary.
Infrastructure has never stopped evolving, and Ansible offers great support for automation of the following aspects:
The chance you are working in the cloud and using virtualization or container-based deployments is very high! Ansible, in that sense, has great support for all of the major cloud providers and supports industry-leading virtualization platforms such as VMware, Vagrant, and Red Hat Virtualization.
Support that Ansible gives is available for all of the major operating systems: Microsoft Windows, Linux (Ubuntu, CentOS, RHEL, Fedora, and others), Unix, and OS X.
An example of infrastructure provisioning might include all of the operations needed to create a new machine (server) and bring it to a working state, including defining the desired state of the system.
Configuration management is the process of maintaining infrastructure and software in a desired and consistent state. It’s a way to make sure that a system performs as expected as changes are made over time.
This is particularly important when it comes to applying changes to the resources. The goal, especially with automation, is to keep the configuration changes transparent and documented. Without it, we couldn’t simply know what changes have been applied to which resource, which again, makes it hard to maintain.
One example is that we would like the production system to have exactly the same settings as a development system (or vice-versa). In that way, we can ensure the consistency of the state of the environment.
With configuration management, you can accurately replicate an environment with the correct configurations and software, as it is documented!
The great benefits of automating and having the configuration management processes in place is that it makes the deployments faster, removes the possibility of the human errors, and manages the system in a predictable and stable state.
With Ansible, teams are able to manage the entire application lifecycle effectively from development to production. Ansible offers a simple way to deploy your multi-tier application in a reliable and consistent way.
Although Ansible does not directly perform source and version control, it has great support for application source control systems like Git and Subversion.
You can configure needed services as well as push application artifacts from one common place. Ansible doesn’t require agents on remote systems, and it offers the possibility to execute a playbook that contains a list of tasks that will be executed in order. That order will always be consistent.
Ansible provides orchestration in the sense of aligning the business request with the applications, data, and infrastructure.
It obviously helps define the policies and service levels through automated workflows, provisioning, and change management. This creates an application-aligned infrastructure that can be scaled up or down based on the needs of each application. This is especially useful when working in an enterprise environment.