Ansible

Ansible is an IT Automation, Configuration Management and Provisioning tool.Provisioning is to install required softwares to make applications run. Configuration Management – manage software on top of hardware. IT automation is to offer cloud provisioning,automating entire IT.

Ansible uses ‘playbooks’ to deploy, manage, build, test and configure anything from full server environments to websites to custom source code for applications.

Features:

  • Agentless: There is no need for agent installation and management on host.
  • Built on top of python.
  • It uses SSH for secure connection.
  • It follows push based architecture for sending configurations
  • Very easy and fast to setup with minimal requirements.
Tools like puppet and chef are pull based and they require agents to be installed like chef client. Agents on the server periodically check for the configuration information from central server (Master). Ansible is pull based and central server pushes the configuration information on target servers. We also have control on when to apply changes made on the servers.

 

 Push based advantages:
  1. Full control
  2. Synchronous
  3. Simple and easy to learn
Push based disadvantages:
  1. Cannot achieve full automation
  2. Lack of Scalability(unless we make use of heavy threading)

Pull based advantages:

  1. Full automation
  2. Scaling up is very easy.
Pull based disadvantages:
  1. We cannot configure system whenever we want it.
  2.  Setting up initially will take a lot of time.
Depending on these pros and cons of both pull based and push based tools, when we have large infrastructure we opt for pull based and where configuration should be fast we use push based.
Ansible agent less architecture:
  • Ansible uses agent less architecture as mentioned. We first establish an SSH connection initially and later we connect to the host using SSH.
  • We make use of host file, which contains IP addresses of all the hosts. We can also group them and perform operations individually or on a group of hosts.
Ansible architecture:
  • The following image shows the Ansible architecture.It consists of host inventory, modules, plugins, connection plugins and playbooks.
  • Modules are pieces of code that get executed on host.
  • Plugins are special kind of modules that are executed before a module gets executed.
  • Connection plugins may be SSH plugin/ docker container plugin.
  • Host Inventory contains the list of hosts grouped together.