Ansible

Introduction

why ansible ?

EVOLUTION 

1980s - Personal computers

1960s - mainframes

1980s - Client Server

1990s - web enterprises

2000s -Cloud

OPS

  • build or provision

  • install and configure

  • change management

  • monitor

keep the lights on .....

OPS

infrastructure
security and compliance
application operations
networks
cloud
containers

devOPS

Manual

Scripts

Automation

Tools

remote management

  • func
  • pssh
  • cluster-ssh
  • parallel-ssh

CONFIGURATIOn management

Deployments and orchestration

capistrano

fabric

provisioning tools

 cloud formation

heat

terraform

configuration management

provisioniong

deployment and orchestration

ad hoc server management

ansible

5 FEATURES

  1. Simplicity
  2. Batteries Included
  3. Infrastructure as a Code
  4. Code vs Data
  5. Idempotence

simplicity

  • SIMPLE TO LEARN

  • SIMPLE to setup

 Simple Things should be simple, complex things should be possible

- Alan Kay

YAML

---
- hosts: all
  remote_user: vagrant
  sudo: yes
  tasks: 
  - name: create devops user with admin previleges
    user: > 
     name=xyz 
     uid=2001 
     group=pqr
     password=er867!fe%rger93$#c

Yet Another Markup Language

Closer to natural language
Self Documented Code
Human Readable
Machine Readable

agent less

push model

  • Uses SSH / WinRM
  • Simple to Setup
  • Smaller Footprint
  • Secure

push 

pull 

vs

Agent

Agent

Agent

simple to extend

3000+
Modules

batteries included

Text

batteries included

systems

cloud

containers

monitoring tools

collaboration tools

network

source control

CORE  

extras

module types

Infrastructure as a Code
---
- hosts: all
  remote_user: vagrant
  sudo: yes
  tasks: 
  - name: create devops user with admin previleges
    user: > 
     name=xyz 
     uid=2001 
     group=pqr
     password=er867!fe%rger93$#c

SCRIPTS      |      ANSIBLE

python

perl

shell

HOW

what

user
name      = xyz
shell     = /bin/bash 
uid       = 5001
group     = xyz
password  = w&*Tnkj23sa

Advantages

version control
Editing and Refactoring Tools
Peer Reviews

TDD

code

 data

vs

port = 80
user = apache
conn = 1024
port = 8080
user = www-data
conn = 512
port = 9000
user = httpd
conn = 4096

profile 1 

profile 2

profile 3

port = 80
user = apache
conn = 1024

code

data

vars

tasks

templates

port = {{ port }}
user = {{ user }}
conn = {{ conn }}

roles 

generic
sharable

idempotencE

ƒ ( ƒ ( x ) ) =  ƒ (x )

idempotencE

ƒ ( ƒ ( x ) ) =  ƒ (x )

Idempotence is the property of certain operations in mathematics and computer science, that can be applied multiple times without changing the result beyond the initial application.  

definition

Which can be simply represented by, 

Lets simplify that a bit.....

First time I read that, I had the same expression  !!

Goa

Bangalore

chennai

Mumbai

1

2

3

how is it relevant to ansible ?

  • Ansible runs are invoked multiple times
  • Every time, it compares the desired state vs current state. And the decides whether to take an action, or to skip. 

desired

desired

current

current

user 
name = xyz
uid = 5001 
pass = pqr
user 
name = xyz
uid = 4000 
pass = pqr
user 
name = xyz
uid = 5001 
pass = abc
user 
name = xyz
uid = 5001 
pass = pqr
useradd
usermod
passwd
task 1 
task 2 
task 3
task 4
task 5 
task 6 
task 7 
task 8
task 1 
task 2 
task 3
task 4
task 5 
task 6 
task 7 
task 8
task 1 
task 2 
task 3
task 4
task 5 
task 6 
task 7 
task 8

1st Run

2nd Run

3rd Run

THE STORY......"

2012

Michael dehaan

2006 - Emerging Technologies Group, RedHat

Cobbler

Src: https://www.ansible.com/blog/2013/12/08/the-origins-of-ansible

Func

Product Manager, Puppet Labs

Ansible

ansible inc

Ansible Works  => Ansible Inc

2013

  • Said Ziouani
  • Michael DeHaan 
  • Tim Gerla

ansible ?

Ansible(noun):  a fictional machine capable of communicating faster than the speed of light. 

Coined by Ursula K. Le Guin  in her 1966 novel Rocannon's World

RedHat

2015

src: http://www.businesswire.com/news/home/20151016005177/en

2014

2016

Releases

Led Zeppelin songs

Van Halen songs

Who is using it ?

Customer Stories

Splunk

Runnable

FATMAP

References

  • Timeline:  https://www.crunchbase.com/organization/ansible/timeline#/timeline/indexBullet Two
  • The Origins of Ansible by Michael DeHaan https://www.ansible.com/blog/2013/12/08/the-origins-of-ansible
  • BusinessWire Article on RedHat's acquisition of Ansible http://www.businesswire.com/news/home/20151016005177/en

Ansible 1: Introduction to Ansible

By School of Devops

Ansible 1: Introduction to Ansible

Overview of What Ansible is.

  • 2,160