Pages

Thursday, January 21, 2016

Getting Started With Ansible


Now in the world of increasing virtual machines, Containers and Cloud environment, consider the process of administering them, keeping them all updated, pushing changes out to them, copying files etc. These things will get complicated and time consuming when we have a large server fleet.

One of the common problems while managing multiple servers is keeping their configuration identical. When we have a large server fleet to manage , maintaining them with identical configuration is very complex. We tweak the configuration by hand on one server and when you set up the same on another server and when we forget the changes that we made on first server, a different ecosystem is born.

What may also happen is that you have to reinstall a server. Say, you’ve got your primary name-server all set up and running for like a year, but then you want to (or have to) switch hosts. How on earth did you install that name-server again? You probably need to start all over and Google your way around. When switching hosts, this is not something you want to think about. These common problems can be solved using the automation languages.

Automation languages are bases on the structure of “describe the desired state of the system and the tool will make that happen”. The automation tools like Chef/Puppet/Ansible/SaltStack are all based on the above principle. The automation languages make sure that the desired state change is done only when all desired steps are successful.

In this article we will explore a automation tool called “Ansible”. Ansible is a helpful tool that allows you to create a group of machines, describe how these machines should be configured or what actions should be taken on them. The main important thing is that all these can be done from one central location.

Ansible uses plain SSH, so nothing needs to be installed on any client machines that we are targeting. Other automation tools like Puppet or Chef will need a agent to be installed on the target machine when performing action on them.

On the Chef Automation area, it utilizes a master-agent model and in addition to the master server it also requires a work station to control the master. Agents need to be installed on the target machine and from the work station using the “knife” tool that uses SSH for deployment and other automation works. Certificates are used in dealing with the authentication with master etc. The agents are configured to check with the master continuously for the changes.

On the other hand, Ansible is quite different. This is first developed and released in early 2012. This is simply written in Python and only requires Python libraries to be present on the servers that need to be configured. Python is almost available in all Linux distos.

Ansible’s is light weight, relative ease of use and speed of deployment compared to other CM tools. Ansible does away with the need for agents; all master-agent communication is handled either via standard SSH commands, or the Paramiko module which provides a Python interface to SSH2.  It also provides a excellent in-built security for SSH.

Ansible at this moment only support Linux and does not support windows machines and also the GUI is quite bad when compared with other Tools.

Installing Ansible

Installing Ansible is Quite Easy. Ansible can be installed using the Yum command on RHEL/Centos Machines where as we need to get certain third party tools for running Ansible on Ubuntu/Debian machines.

Use “yum install Ansible” on RHEL/Centos Machines.

Other way of installing Ansible is using by using the PIP of Python. PIP is a tool for installing and managing python packages. This works for most linux machines as “Pip install Ansible”

One more method of installing Ansible is by downloading the Source code from the Git-Hub repository and running the setup command.

More to Come, Happy Learning J

1 comment :

  1. I would like to know whether Ansible supports AIX and Solaris OS ?

    ReplyDelete