Applying Thoughts

"Sometimes I Win, Other times I learn. but I never lose."

August 27, 2016

Introduction to Ansible

Ansible is a software platform for configuring and managing computers. It combines multi-node software deployment, ad hoc tasks execution and configuration management.

Salient Features:

ØDocumented and reusable machine configuration
     Øwritten in Ansible playbooks.

ØAgentless
     ØNo client daemon required on target machines.

ØIdempotent
     ØCode defines states instead of actions.

ØMulti-node orchestration
     ØConfigure many nodes simultaneously.

 

Why Ansible

It is a free open source application
Agent-less – No need for agent installation and management
Phython/yaml based
Highly flexible and configuration management of systems.
Large number of ready to use modules for system management
Custom modules can be added if needed
Configuration roll-back in case of error
Simple and human readable
Self documenting.
 

Ansible: getting started

Installing:

$ (sudo) pip install ansible [--upgrade]

Can install via apt, yum, pkg, Homebrew in addition to from source
 

Configuration of ansible

 Ansible has a configuration & default inventory file used to define which servers it will be managing
Create a inventory file with list of client machines you wish to access via this server under /etc/ansible/hosts. Below is sample inventory file.

[Servers]


192.168.85.135


192.168.85.136

 [Local]

127.0.0.1

 [Prod Server]

114.9.75.65

114.9.75.63

114.9.75.61

Run the ping command below to see if indeed you are reaching both client nodes

$ ansible -m ping all

÷all - Use all defined servers from the inventory file.

÷-m ping - Use the "ping" module, which simply runs the ping command and returns the results.

 Ansible: structure

Ansible uses playbooks written in the YAML language for orchestration

Inventory file = definition of your architecture

÷Static / dynamic supported
Playbooks
÷can run multiple Tasks and provide some more advanced functionality that we would miss out on using ad-hoc commands
Roles
÷Roles are good for organizing multiple, related Tasks and encapsulating data needed to accomplish those Tasks.
Roles have a directory structure like this:
  Files
        Handlers
        Meta
        Templates
        Tasks
        Variables

 

Ansible: further reading / meta

Ansible Tower

¡Front end to Ansible
¡Manage team privs etc.
¡RESTful API
¡Audit, scheduled jobs etc.
¡Fairly expensive
Ansible Galaxy
¡out-the-box Ansible roles
¡don't have to reinvent the wheel each time
¡still relatively new so not too mature
¡installed via simple CLI.
 
For more information, please refer below links:
Ansible Docs: http://docs.ansible.com/

How Ansible is helpful in SDN - Openstack space:

 

3 comments:

Anonymous said...

how is it related to Ansible here?

DevOps said...

It's really good article..
DevOps Training
DevOps Online Training

rajani said...

This is good information and really helpful for the people who need information about this.
Docker Training in Hyderabad
Docker and Kubernetes Online Training
Docker Training