The rise of cloud technologies and Dev-Ops culture has resulted in the proliferation of various automation tools. The automation tools, in turn, increased the speed of development and service delivery. One of the tools which have found a large adoption is Ansible. This Ansible introduction will uncover the fundamental concepts.
What is Ansible?
Ansible is often defined as an infrastructure configuration and orchestration tool. Ansible allows automating tasks, streamline service provisioning, and enabling infrastructure as a code. There are many examples of what you can do with Ansible. This Ansible introduction will look at a few of these.
For example, you can automatically deploy your infrastructure in the cloud or on-premise. Ansible supports on-premise virtualization platforms, such as VMware or MS Hyper-V. It also supports cloud infrastructure such as AWS, Google Cloud, or Microsoft Azure. You can also take it a step further and configure your servers at scale.
Another excellent use case is application deployment. You can set up your environment and deploy all required packages and dependencies.
IT Infrastructure teams use Ansible for their infra orchestration and management. It allows them to manage networks, servers, storage, and many other devices at scale. This, in turn, gives them incredible speed and efficiency. A significant part of infrastructure management is ongoing audit and compliance checks. Ansible can help you here too.
Ansible is an open-source project that started in 2012 and is now prevalent in the IT world. Let’s try to understand why IT professionals choose this tool today. And, let’s see why it continues to grow its community and several contributors.
First, since it is open-source software, this means it is vendor-agnostic by definition and by design. Thus, Ansible is applicable in several environments and infrastructures. Besides, it is agentless, and it does not need anything to be installed. Ansible uses the universal management protocol SSH to communicate with the devices and servers. On top of that, it supports RESTful API, which has become popular everywhere.
Moreover, Ansible is simple. You do not have to learn a programming language to get started with Ansible and appreciate the value it brings. The secret of its simplicity is that Ansible is using YAML (Yet Another Markup Language). YAML makes it easy to write automation scripts called “playbooks” in Ansible terms.
Another great advantage of Ansible is that it is mighty yet flexible. It is valuable in a large-scale deployment as well as suited for small tasks. As Alan Kay said: “Simple things should be simple, complex things should be possible.”
Finally, Ansible is a free tool available to everyone despite its acquisition by RedHat a few years ago. RedHat provides paid services and support for Ansible, but any company can use it free of charge.
Playbooks and Inventory
Now, let’s take a closer look at the Ansible components. Playbooks are the main component of Ansible. You can think of a playbook as a script that automates tasks. The only difference is that you do not need to know any programming language to write a playbook. YAML is used to write playbooks, and it is all it takes to get started. Another essential concept is inventory, which allows you to scope your server or devices, group them and classify them.
In other words, playbooks are instructions of what to run, and inventory is a scope of where to run your tasks. This Ansible Introduction will be followed by useful
What makes the usage of Ansible so universal is the wide variety of its modules. Modules are often referred to as “task plugins” or “library plugins.” You use YAML to write a playbook, and it is simple. This simplicity is only possible because modules abstract and take over all complexity from playbooks.
Think of modules as pre-existing libraries for all imaginable use cases. You use modules for automating a software deployment on a Linux server. You use modules for making changes to your AWS cloud infrastructure. And you use modules for configuring your network devices (Cisco, Juniper, Arista). There is even a module that enables you to interact with a specific OS or platform.
Modules are usually written in Python, and it is worth mentioning that Ansible implementation is based on Python. Although nobody prevents you from writing your module in a different programming language, this is rarely required because the standard modules will help you solve your challenges in 99% of the cases.
Most of the time, you will use a CLI to interact with Ansible, run playbooks and check the task’s output. Once you hit the ground running, you will appreciate how simple it is. Remember? Simple things should be simple! However, using CLI might not be enough in a large enterprise environment. This is especially true if you have an extensive list of requirements.
Ansible Tower was established to address these needs. It is one platform “to rule them all.” It serves as a centralized repository for all the playbooks and enables role-based access. Best of all, it is GUI-based, which lowers the bar for the Ansible users. Keep in mind that Ansible Tower is a paid version.
As you can see in this Ansible Introduction, Ansible can fit in a broad range of use cases. Simply design your automation scenario, and Ansible will help you to make it happen.
Want to learn more?
There is to much more that you need to know about Ansible.
About the Authors
Anto's editorial team loves the cloud as much as you! Each member of Anto's editorial team is a Cloud expert in their own right. Anto Online takes great pride in helping fellow Cloud enthusiasts. Let us know if you have an excellent idea for the next topic! Contact Anto Online if you want to contribute.
Support the Cause
Support Anto Online and buy us a coffee. Anything is possible with coffee and code.