May 23, 2015

A powerful DevOps tool: Ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.
At the Openstack Summit in Vancouver I attended a great session presented by two Cisco colleagues:
Juergen Brendel (@brendelconsult), David Lapsey (@devlaps) both from Cisco Metacloud.
These are my notes, that you could find useful as a easy introduction.
But I suggest you to watch the recording of their session at the end of this post, because it is very educational.

Configuration Management tools
They are better than scripts, that in turn are better than written manual instructions, that are better than a seasoned administrator's memory.
CM tools describe the desired state of a resource (i.e. a server) via assertions (ensure that… exists/installed/...): a declarative way to provision resources.
Comparison of existing tools:
puppet dates 2005, chef dates 2009 - they are powerful and rich
salt dates 2011, ansible dates 2012 - they are easy and quick

It's written in Python, uses YAML to create Playbooks (description of the desired state)
It's simple: no central server to maintain, no keys management, NO AGENT on the managed servers - but requires ssh and python on the target server (powershell support is coming).
Ansible executes commands in explicit order (so there are no race conditions due to dependencies).

Modules are pieces of code that do a single thing.
There are hundreds of modules available to reuse.
They’re copied to the target server at runtime, executed there (they return results) and then deleted.

Inventory file
It defines hosts and groups them so that you can apply same commands to all at once.
Adhoc commands apply to groups - example: ansible -i hosts europe -a “uname -a", where europe is a group.

they are written in YAML and tell Ansible what to do (a sequence of tasks)

Projects layout
A Ansible project is made of:
config files
inventory files
group variables
yaml file

contains tasks, handlers, templates, files, vars
apply to servers (that have the same role)
can be included in playbooks

Usage of API
to manage infrastructure and services
there are modules available for public cloud and private cloud management systems

Vagrant is a tool that matches Ansible very well:
it is used to create VM in cloud
it can use Ansible as a provisioner
written in Ruby
vagrant up - creates the vm
vagrant provision - calls Ansible

A single Ansible playbook can be used to deploy apps locally and in the cloud
Download Ansible for free from Github.


  1. For the purpose of setting up the Ansible learning environment, we recommend using the following software: Virtual Box, Vagrant and Git for Windows.


  2. Ansible Training expertise and make you learn all that is required to provision, deploy, and manage compute infrastructure across cloud, virtual,
    and physical environments. Ansible further help you build a strong foundation for DevOps.
    Ansible is an automation and configuration management technology used to provision, deploy, and manage compute infrastructure across
    cloud, virtual, and physical environments. In this course, students will learn the basics of Ansible and watch a simple Ansible playbook being created from
    beginning to finish.

    Ansible Architecture

    Ansible distinguishes two types of servers: controlling machines and nodes. It works by connecting to your hosts and pushing out small programs,
    called “Ansible Modules”. These programs are written to be resource models of the desired state of the system. The controlling machine describes the location
    of nodes through its inventory. Ansible then executes these modules (Nodes are managed by a controlling machine over SSH).

    Design goals:

    The design goals of Ansible include:

    Minimal in nature.
    Low learning curve
    Highly reliable

  3. A lot of the DevOps skills have roots in Software Engineering. Being a Network Guy ™ this may seem like a little bit of a paradigm shift but here's something cool about this blog on Devops.

  4. Thanks for sharing the very useful info about DevOps and please keep updating........