The basics
Shreya Chakraborty
Software Engineer

Why Configuration Management?

  • Snowflake servers
  • Configuration management (CM) is a systems engineering process for establishing and maintaining consistency of a product's performance, functional, and physical attributes with its requirements, design, and operational information throughout its life.(WIKI)

Brief History

  • Ansible was released in 2012 by Michael DeHaan
  • Ansible, Inc. was the company set up to commercially support and sponsor Ansible. Red Hat acquired Ansible in October 2015

YAML Ain’t MARKup Language

---
- hosts: webservers
 vars:
   http_port: 80
   max_clients: 200

 

[
 {
   "hosts": "webservers",
   "vars": {
     "http_port": 80,
     "max_clients": 200
   }
 }
]

 

Basic Playbook Anatomy

Variables

  • Inventory variables
  • Playbook variables
  • Variables from roles and included files
  • Command line variables

Facts

  • Fact caching
  • Dynamic variables - set_fact

Modules, Modules, Modules!!!

Roles

Ansible Vault/Encryption

  • specific variables in files
  • encrypt entire file

Ansible Command Line 

Idempotency

Why Ansible

  • Run commands parallely execution across multiple machines.

  • Multiple idempotent 'modules'

  • Automatic reporting of task execution.

  • Tagging, and restricting tasks.

  • Readable syntax , sufficient logic flow and ease-of-variable-managing.

  • Composability/modular

  • Agentless architecture

Best Practises

  • Use role name prefixes for all variables in roles
  • Use Native YAML Syntax
  • Use jinja filters instead of conditions
  • Use Modules instead of Run Commands
  • Build custom modules pertaining to your use cases
  • Use ansible-vault for sensitive data 

Success Stories

 

We are hiring!!!

Inventory

  • Inventory
    • Hosts
    • Groups

Playbook

  • Hosts and users

  • Task list

  • Handlers

Templates

  • Jinja2

Handlers

Conditionals

Tags

Ansible introduction

By Shreya Chakraborty

Ansible introduction

  • 734