Introducing Ansible

Introducing Ansible

Are you a System Administrator burdened with a lot of work? Where you need to make configuration changes such as tuning Kernel Parameters, doing DNS/AD server changes etc, install software packages, grepping critical system information's (such as installed memory or release version) quickly and make changes based on them across the fleet of thousands of servers.

Are you a Software Developer or Tester who does frequent config changes and deployments within their Dev/QA environments?

If the answer is "YES" to both the above questions then you are at right place. The solution to all these problems is "Ansible".

What is Ansible ?

As per official documentation "Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs."

Ansible is very simple, open source and human readable automation tool. It is agentless and uses SSH connection to orchestrate all the tasks which we were talking above such as configuration management, application deployment, and provisioning in a flat or multi-tier environment.

In a very short span of time it has become one of the world’s most popular open source IT automation tool.

Why One Need Ansible?

Before starting using any tool we first need to understand why we need it!

To understand this let’s take an example; you’ve got an application which should be running on top of a webserver such as Apache or Nginx. Now if you want to run that application on your systems, you would need to meet some prerequisites like webserver packages should be installed, the application files needed to be copied, proxy and load balancer settings (if required) needs to be done, some supporting static files needs to be present on all your test/dev/prod environments.

So, here Ansible comes into the picture which will make sure that all these prerequisites such as basic packages are installed in your systems and dependent files or templates are copied and config changes are made so that your application can run smoothly on all the environments.

Architecture

I will make you understand Ansible's Architecture with the below ref diagram.

Ansible_Architecture.png

Let's understand individual component.

Modules: Ansible modules enables you connecting to your nodes. Modules can directly be executed on remote nodes or via playbooks. You can write your own custom modules as well. Modules can control system resources like services , software's and/or files etc. Ansible modules are also called as task plugins. Ansible removes modules from remote systems when task finished.

Inventory: Inventory is just another text file where you keep the IP addresses or hostnames of your remote servers you want to manage. They can be in grouped together as per your preference in INI or YAML files.

Playbooks: Ansible scripts which executes tasks in an order are known as Playbooks.

Plugins: While modules execute on the target system in separate processes, plugins execute on the control node within the /usr/bin/ansible process. Plugins are responsible for - transforming data, logging output, connecting to inventory, and more.

Key Features

Here are some exciting features of Ansible.

  1. Easy setup: Setting up Ansible is very easy task. You just need to run few commands and that's it! We will cover that part in our next articles.

  2. Agentless: This is I feel the standout feature of Ansible as it doesn't require any agent software to run on your client systems that directly means means more resources available for your applications. It makes it very efficient in nature. You just need the SSH connection to be established to do your job. It enables you and your team to start automating things right away.

  3. Python as a backend: Ansible tool is built on top of python language, which makes it very fast and one of the robust tool among its competitors.

  4. Simple and Human Readable: In Ansible the automation scripts we write are called "Playbooks" and those playbooks are written in an extremely simple language called YAML. YAML is a human-readable data serialization language. So one no need to acquire any training to gain some special coding skills to write or understand the Ansible automation playbooks.

What can be achieved with Ansible?

  1. OS Provisioning : Ansible make it really easy when you’re using PXE boot to provision bare-metal servers or Virtual Machines, or creating virtual or cloud instances from the templates. It will automate the complete post install stuff such as creating users , tuning some performance parameters, installing updates and packages.

  2. Configuration Management : When you want to make any kind of configuration changes in one or more files across the systems (irrespective of their OS flavor) can be easily achieved by Ansible and in one go it can do all this as it is not feasible for you to manually go and update each and every machine.

  3. Continuous Delivery : In today's IT industry and in Software Development environment DevOps has become an vital part of the culture and Continuous Delivery is one of the most important part of that culture. With Ansible it becomes seamless to deliver and deploy the changes at a rapid pace.

  4. Application Deployment: As we have already discussed above that Ansible makes application deployments tasks pretty smooth and fast. All you have to do is list out the IP addresses of your servers in a file which we call an inventory file and write a playbook to deploy your application.

  5. Security and Compliance: Security policies can be easily integrated with Ansible and can be deployed site-wide in no time. When it comes to store critical/confidential information on Ansible Controller node (such as passwords etc) Ansible has an inbuilt concept of "vault" which encrypts all the critical piece of data and ensures the safety.

  6. Orchestration: When it comes to doing deployments of clustered applications on complex environments like multiple datacenters, public, private and hybrid clouds Ansible comes very handy in orchestrating all this for us. Ansible works in an order which ensures no downtime while upgrading applications or servers.

Conclusion

I hope now you have a fair enough idea about what is Ansible and what we can get out of it. It's an amazing tool to automate your stuff.

That's all for now. Hope you like the article. Stay Tuned and don't forget to subscribe for more.

Thank You!

Did you find this article valuable?

Support Learn Code Online by becoming a sponsor. Any amount is appreciated!