Getting started with Ansible

Ansible is a configuration management system written in Python using a declarative markup language to describe configurations. Is an open source automation engine that automates the cloud of provisioned resources, manages configuration, and deploys applications. Typically used to manage Linux nodes, but also supported by Windows. Supports working with network devices on which Python version 2.4 and higher is installed via SSH or PowerShell connection.

Ease and usability are the main goals Ansible with a strong focus on safety and reliability. The Ansible developers believe that simplicity applies to all sizes of environments, so design is for busy users of all types: developers, sysadmins, engineers, IT release managers, and everything in between. Ansible is suitable for managing all environments, from small installations with multiple instances to enterprise environments with many thousands of instances.

We already mentioned that Ansible manages machines in an agentless manner. The question of how to update the remote daemons or the problem is not being able to manage systems because daemons might be uninstalled is not a problem. OpenSSH is one of the most peer-reviewed open source components, so security is greatly enhanced. Ansible is decentralized – it relies on existing operating system credentials to control access to remote computers. If necessary, Ansible can easily connect with Kerberos, LDAP and other centralized authentication management systems.

Ansible design principles

  • Simple installation process and minimal training;
  • Machine control is very fast and parallel;
  • Avoiding user agents and additional open ports by using the existing SSH daemon;
  • Description of the infrastructure in a language that is both machine-friendly and human-friendly;
  • Security and Convenience Verifiability / Review / Rewriting of Content;
  • Control new remote machines instantly, without bootstrapping any software;
  • Allow module development in any dynamic language, not just Python;
  • Used as foliar;
  • A simple IT automation system to use.

Installing Ansible

By default, Ansible manages machines over SSH. Once installed, Ansible will not add the database, which means there won’t be any daemons to start or keep running. You can easily install Ansible and manage remote machines from it. Ansible can be installed on Red Hat, Debian, CentOS, OS X, BSD and other systems using operating system managers, PIP packages, or from source.

RED HAT / CENTOS / FEDORA

Fedora users can install Ansible directly, however, CentOS and RHEL users need to enable the EPEL repository first. This can be done with:

RHEL / CentOS 7 64-Bit #

# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm

# rpm -ivh epel-release-7-9.noarch.rpm

RHEL / CentOS 6 32-bit

# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

# rpm -ivh epel-release-6-8.noarch.rpm

RHEL / CentOS 6 64-bit

# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

# rpm -ivh epel-release-6-8.noarch.rpm

After installing lightweight, run the following command:

# yum update

# yum install ansible

Ubuntu

Before installing Ansible on Ubuntu, the PPA must be enabled:

# sudo apt-get install software-properties-common

# sudo apt-add-repository ppa:ansible/ansible

# sudo apt-get update

# sudo apt-get install ansible

Debian

Debian users can use the same source as the Ubuntu PPA:

With one of your favorite text editors, add the following line to your /etc/apt/sources.list file:

deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main

Save and close the file and then run the command:

# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367

# sudo apt-get update

# sudo apt-get install ansible

Ansible can be installed using PIP. The following commands will install some much needed Python tools, PIP and then Ansible:

# apt-get install python-setuptools

# easy_install pip

# pip install ansible

By default, Ansible uses OpenSSH for remote communications and has a default inventory file where you can define which servers to manage. File: / etc / ansible / hosts.

For reference purposes only, you can copy the default file so you can check it later:

# cp /etc/ansible/hosts /etc/ansible/hosts.org

Now you can edit the inventory file according to your needs. More information on Ansible inventory can be found here

Now, this is just a glimpse of what Ansible is offering users. This simple article will stimulate your interest in Ansible and the amazing possibilities it offers.

For more details, please read documentation by Ansible.

Sidebar