Ansible for Devops

All my ansible code which is mentioned in this article is in my github repo in below link just download and run it in your own machine.

       Link is i.e.  Ansible4devops

Ansible is a IT automation tool useful to build and deploy from servers to applications to monitoring. let's say end-to-end IT automation tool.

Unlike other automation tools like puppet,chef etc, Ansible doesn't need any agent setup in client side.
Only thing ansible needs is python, by default all Linux flavours has python by default and Ansible works over SSH-KEYGEN exchange from control server to target server.

Most importantly it easy to implement and understand.

This blog is for how to work effectively with Ansible which will help to solve your day-2-day problem in IT.

Install Ansible Assuming if you already have python in your Linux box.(Comes with OS itself :)  )

In order to install ansible just do #yum install ansible  , if and only if you have added an EPEL repo in your /etc/yum.repos.d folde…

python in liunx

Installing Python-3 ,Running the Python interactive-console,Passing arguments to a script Installing python-3 in centos-6 in Traditional Way and using yum
Before this just add an EPEL repo to your cent-os yum list.
Traditional way

# yum install gcc  --> Its a just dependency package
Down load here
# cd /usr/src
# wget

Now extract the downloaded package.

# tar xzf Python-3.4.3.tgz

# cd Python-3.4.3
# ./configure
# make altinstall

make altinstall is used to prevent replacing the default python binary file /usr/bin/python.
Now remove downloaded source archive file from your system
# rm Python-3.4.3.tgz
Check the latest version installed of python using below command
# python3.4 -V
Python 3.4.3
Using yum package:#sudo yum install
#sudo yum search python3
Most probably, you would install Python 3.4:
#sudo yum install python34u

# python3.4 -V
Python 3.4.3
you can run python using scripts and interactive c…

Setting Up An EC2 Instance With IAM Role And Python Boto SDK

1. We just have to create a ROLE using AWS IAM console as below.

2. Launch  an  instance with that  role(ec2-admin) and that's it . From that instance you can do what ever operation you want like from creating S3 bucket and creating Route53 hosted zone or creating Elastic LoadBalancer  or what ever service you want to call you can do that from that EC-2 instance and most importantly you no need to specify the ACCESS_KEY and SECRET ACCESS_KEY to access the aws services.

3.You just have to install python boto SDK in that  instance and just call s3 service as below using a simple python file i.e.

#yum install -y python-pip
#pip install boto (or)

git clone git://
cd boto
python install

That's more than enough.
Just create a python file as below and run it as ./

[root@ip-10-0-1-6 boto]# cat
#! /usr/bin/python
import boto
conn = boto.connect_s3()
bucket = conn.create_bucket('hanumansjan24_2016')

[root@ip-10-0-1-6 boto]#

Just Run it a…

SSH Tunneling

SSH Tunneling

It is basically a way to allow one system or service to tunnel to remote system or service Remotely.
What it means is
I am going to make a connection in one location and it automatically going to forward or tunnel over SSH to different location.
It allows us...for example get around things like Firewalls that may restrict me  either in hotel or work ... wireless access points or other items that may be less secure or more restrictive.....
It allows us to securely run a service  that i might not otherwsie be  able to run.
Example: I can run localhost connection that actually tunnels out to our remote host.
It is very easy to setup ...we need localhost + local port and remotehost + remote port
Local Machine:
[root@bharath bharath]# hostname bharath.local.machine [root@bharath bharath]#

Remote Machien: Remote Machine IP:
[root@bharath bharath]# hostname bharath.remote.machine [root@bharath bharath]#
What i am going to do is... i want my local connection  & w…

All About Amazon Web Services(AWS)

AWS is made up of Regions and Availability Zones.

AWS EssentialsStorage Basics On AWS
There are different types of storage available in Amazon Web Services. here i will give core understanding of storage devices when we are thinking to architecting our applications in AWS.
1.S3(Simple Storage Service-S3) : It's a scalable object & File storage.You can store objects & Files such as pdfs,jpgs, anything that a regular operating system files.
You can store unlimited data as files in objects(objects are from 1 byte to 1 TeraByte) you can upload your data form your off-site to your AWS S3 account. you can do  amazon server side encryption for your data. you can host static files and websites as well.
The data in S3 automatically syncs to different availability zones in a region. So that it can be useful for the high available purpose as well.Hence S3 can be used for an high available environment.
You can host private content using signed URLS/CDN. S3 comes with LifeCycle Policies…