Sunday, April 23, 2017

What is Ansible and How it Works

What is Ansible

Ansible is a IT automation, configuration management tool to manage the infrastructure

How Ansible Works

Ansible is agent-less (that means no need of any agent installation on remote nodes) tool and uses SSH protocol to deploy modules on remote nodes. These modules are stored temporarily on remote nodes and communicate with the Ansible machine through a JSON connection. 

The location of nodes are specified by controlling machine through its inventory.

Ansible can handle 100’s of nodes from a single system over SSH connection and the entire operation can be handled and executed by one single command ‘ansible’. 

But, in some cases, where you required to execute multiple commands for a deployment, here we can build playbooks.

Playbooks are bunch of commands which can perform multiple tasks and each playbooks are in YAML file format.

Pre - Requistes for Ansible


Operating System: RHEL/CentOS/Fedora and Ubuntu/Debian/Linux Mint

Packages

Jinja2: A modern, fast and easy to use stand-alone template engine for Python.
PyYAML: A YAML parser and emitter for the Python programming language.
parmiko: A native Python SSHv2 channel library.
httplib2: A comprehensive HTTP client library.
sshpass: A non-interactive ssh password authentication.

Managed Node Requirements

On the managed nodes, you need a way to communicate, which is normally ssh. By default this uses sftp. If that’s not available, you can switch to scp in ansible.cfg. You also need Python 2.6 or later.


Remote Connection Information

By default, Ansible 1.3 and later will try to use native OpenSSH for remote communication when possible. This enables ControlPersist (a performance feature), Kerberos, and options in ~/.ssh/config such as Jump Host setup. However, when using Enterprise Linux 6 operating systems as the control machine (Red Hat Enterprise Linux and derivatives such as CentOS), the version of OpenSSH may be too old to support ControlPersist. On these operating systems, Ansible will fallback into using a high-quality Python implementation of OpenSSH called ‘paramiko’. If you wish to use features like Kerberized SSH and more, consider using Fedora, OS X, or Ubuntu as your control machine until a newer version of OpenSSH is available for your platform – or engage ‘accelerated mode’ in Ansible.

No comments:

Post a Comment