Ansible

What Is Ansible?

Ansible is a powerful tool that is helpful while automating cross-platform computer support. Primarily, it is used by IT professionals. Tasks such as application deployment, updating workstations and servers, cloud provisioning, configuration management, intra-service orchestration, and many other tasks that a system administrator has to perform, can be easily done with Ansible. Since it doesn’t depend on agent software and additional security infrastructure, it makes the deployment seamless.

To automate the task using Ansible, you need certain instructions to accomplish the desired results. These instructions are written in the form of a simple script form that helps system administrators to do version control. It’s a good example of software that contributes to the “infrastructure as code” movement in IT organizations. In simple words, it encourages the idea that the maintenance of servers and client infrastructure can be treated as software development. And with code repositories of self-documentation, it provides simple, effective solutions to run an organization irrespective of staff changes.

Being the backbone of automation, DevOps, and system administration, it also provides solutions to everyday users. Whether it’s configuring a single computer or a whole network of computers, anyone who has no programming skills can use it. Ansible instructions are human-readable. So if you’re an expert or a novice, you won’t find Ansible files hard to understand.

How Ansible Works?

Ansible works with two categories of computers: the control node and managed nodes. The control node runs on Ansible and also manages the managed node. However, there must be at least one control node, still, a backup control should also exist.

To work with Ansible, nodes (clients, servers, or anything you want to configure) needs to be connected on a network. Then a small program called the Ansible module is sent to that node. Ansible executes these modules over SSH and removes them once the execution is complete. Although this integration is possible when the Ansible control node gets access to the managed nodes. SSH keys play vital roles to provide access yet other forms of authentication are also supported.

What is Ansible Architecture?

Ansible architecture includes three components that are:

  • Managed Hosts

    These network devices are managed by the controller hosts with the help of Ansible. However, Ansible is not installed on these devices.

  • Controller Host

    To execute the Ansible commands and playbooks, you need control nodes. Any Python installed computer can be used as a control node. Be it a laptop, desktop, or server, all can run Ansible. However, you can have multiple control nodes but none of them should be a Windows machine. A controller node has the following information:

    • Inventory: It holds the list of managed nodes. Apart from holding managed nodes’ information like the IP address of each node, these inventory files can organize and nest these nodes to scale effectively. Inventory files sometimes called “hostfile”.
    • Configuration Files: This is the core of Ansible. These Ansible configuration files regolate the behavior of all interactions that a control node manages.
  • Playbooks

    Ansible is easy even in the case of multi-machine deployment systems or deploying complex applications. Ansible Playbooks offers repeatable, reusable, and simple configuration management. Any task that needs to be executed more than once can be done by writing a playbook and putting it through source control. In order to push out new configurations or confirm the configuration to remote systems, you can use a playbook. A playbook includes some features that are:

    • Templates: The templates are used to modify playbooks. The template files hold the variables that can be changed later.
    • Modules: These are separate codes, also known as “taskplugins” or “libraryplugins”, which can be used from the command line or in a playbook task to provide customized functionality. After executing each code on the remote node, Ansible collects the return value.
    • Plugins: These plugins are codes that add more to the core functionality of Ansible. With the help of these plugins, you can enhance the capabilities of Ansible by converting it into a feature-rich and flexible tool.

Benefits of Ansible

Here are some benefits of Ansible:

  • Ansible is an open-source tool that means anyone can use it for free.
  • It is simple to install and does not require special system administration skills to use it.
  • Its flexible modules, plugins, inventories, and playbooks help you orchestrate in large environments easily.
  • Due to its agentless capabilities and OpenSSH security features, it is considered a very secure tool.
  • Its comprehensive documentation and easy to learn structure & configuration makes it simple to understand.

How Ansible Has Helped NASA?

When NASA deployed its 65 applications to the Cloud from the traditional hardware, it faced lots of challenges. Not so familiar with the Cloud environment, NASA’s team was facing difficulties to manage the new system: extended Virtual Private Clouds (VPCs) and AWS accounts. Remember, even for simple tasks like ensuring every server’s access to every system administrator, or simple patching was tiresome.

But when they installed Ansible Tower for Configuration Management, the team’s efficiency increased multiple times. Tasks that usually used to take hours or even a couple of days or more (in some scenarios), could be done in minutes. For example, updating nasa.gov went from over 1 hour to under 5 minutes.

Besides NASA, other prominent organizations like Microsoft, BMW, Siemens, etc. have also enhanced their productivity by using Ansible.

Conclusion

People prefer DevOps because of automation, and tools like Ansible does it tremendously well. However, it’s not the only configuration management tool. Chef and Puppet are its near rivals and also capable of handling server configuration. But features like agentless architecture, push and pull configuration, and configuration language - YAML - one of the easiest languages, makes this tool unique. Besides, it is low in price and makes scalability easier.