Ansible Dynamic Inventory

Getting started with Ansible Dynamic Inventory for AWS Cloud

Install Python Boto :
##################

# yum install Python-pip

#pip install python-boto

AWS CLI  Installation  :
###################
     
 # pip  install  awscli        

AWS CLI  CONFIGURATION :
########################

     # aws configure
       AWS Access Key ID [****************W5UQ]:
       AWS Secret Access Key [****************0QTW]:
       Default region name [us-west-2]:
       Default output format [None]: 

Downloading  Ec2.py and  Ec2.ini  file  for Dynamic  Inventory :
#################################################

# cd  /etc/ansible/
#  wget  https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.py
#  wget  https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini
#  chmod  +x   ec2.py  ec2.ini

Exporting some variables :
#######################

# export ANSIBLE_HOSTS=/etc/ansible/ec2.py
# export ANSIBLE_INI=/etc/ansible/ec2.ini


Now get all running Instances details info :
###################################

# /etc/ansible/ec2.py  --list

Checking  Ping  module if firewall is configured : 
#####################################

# ansible  all -u ec2-user --private-key /home/shashank/Downloads/key1.pem -m ping 

52.41.118.0 | SUCCESS => {
    "changed": false,    "ping": "pong"}


All done ! Now deploy your applications on AWS Cloud using Ansible
#####################################################


Post a Comment

0 Comments