Introduction to Ansible

In this blog post, I’m going to introduce you to Ansible, an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code. I’ll cover what Ansible is, what it can do, and how you can start using it today. I have also linked my accompanying webinar in this post to help you get started!

What is Ansible?

Ansible is an open-source automation tool, or platform, used for IT tasks such as configuration management, application deployment, intraservice orchestration, and provisioning. 

In the world today, there is a high demand for automated processes in an effort to make information and resources easier and faster to access. IT environments have become quite complex and often prove to be tedious to scale manually. 

Automation helps to alleviate tiresome tasks, not just making developers’ jobs more manageable but allowing them to focus attention on other tasks that add value to an organization or business. In other words, it frees up bandwidth and increases efficiency. Since arriving on the scene, it has skyrocketed in popularity among developers. Let’s look at some of the reasons for Ansible’s popularity.

How does Ansible work?

It is designed for multi-tier deployments, so Ansible models your IT infrastructure by describing how all of your systems interrelate. It does not use any agents and no additional custom security infrastructure, so it’s easy to deploy. It also uses simple language that allows you to describe your automation jobs in basically plain English.

Ansible

First, we have the user who writes the Ansible playbook. Playbooks are one of the core features of Ansible and tell Ansible what to execute. They are like a to-do list for Ansible that contains a list of tasks. So playbooks are written in YAML and those are going to invoke Ansible modules in things called tasks, which get executed sequentially in order from top to bottom. 

Those modules are essentially executable bits of code that are pushed out to your target machines. However, we don’t need to understand the underlying code of these modules to get them to work, we just need to be able to pass the correct arguments to our playbook. Those modules are going to be used to act against our inventory, which consists of hosts and groups. 

So in this example, we have two hosts, in the web group and one host in the DB group. That inventory can come from just about anywhere since Ansible plays nice with a bunch of different cloud providers. The only thing that is crucial is that we have a host to manage because without one you cannot execute anything. Once we have that we can push out the playbook that uses modules that acts against that inventory. 

Ansible’s Features

Ansible provides reliability, consistency, and scalability to your IT infrastructure. You can automate configurations of databases, storage, networks, firewalls using Ansible. It makes sure that all the necessary packages are consistent on the server to run the application. Now let’s take a look at its features.

  1. Ansible is agentless so there is no software or any agent managing the node.
  1. It is built on top of python, which is fast and one of the robust programming languages today.
  1. Ansible uses a very simple passwordless network authentication protocol which is secure. So, your only responsibility is to copy this key to the client.
  1. Ansible uses Push architecture meaning you only commit necessary information. All you have to do is write down those configurations in playbooks and publish the changes. Imagine having to push the changes to thousands of servers in minutes, that could take forever to do manually.
  1. Finally, very little setup and configuration needed to get Ansible up and running. 

Use Cases

Ansible

Finally, we’ll go over a few use cases to see how Ansible unites the development cycle into a single experience.

Provisioning 

If you’re spinning up servers/VMs or creating cloud instances from templates, Ansible and Ansible Tower help streamline the process.

Configuration Management

Centralizing configuration file management and deployment is a common use case. It is how many users are first introduced to the Ansible’s automation platform.

Application Deployment

When you define your application with Ansible and manage the deployment with Ansible Tower, teams are able to effectively manage the entire application lifecycle from development to production.

Continuous Delivery

Creating a CI/CD pipeline requires buy-in from numerous teams. You can’t do it without a simple automation platform that everyone in your organization can use. Playbooks keep your applications properly deployed (and managed) throughout their entire lifecycle.

Security Automation

Scanning and remediation of site-wide security policy can be integrated into other automated processes.

Orchestration

Configurations alone don’t define your environment. You need to define how multiple configurations interact and ensure the disparate pieces can be managed as a whole. Out of complexity and chaos, Ansible brings order.

Cassandra.Link

Cassandra.Link is a knowledge base that we created for all things Apache Cassandra. Our goal with Cassandra.Link was to not only fill the gap of Planet Cassandra but to bring the Cassandra community together. Feel free to reach out if you wish to collaborate with us on this project in any capacity.

We are a technology company that specializes in building business platforms. If you have any questions about the tools discussed in this post or about any of our services, feel free to send us an email!


Join Anant's Newsletter

Subscribe to our monthly newsletter below and never miss the latest Cassandra and data engineering news!