Created
February 3, 2017 09:34
-
-
Save rahulkrishnanfs/1bfe0329b62ab158630cf56a962cad9d to your computer and use it in GitHub Desktop.
AWS Dynamic inventory Script Testing - Ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tesing on | |
------------------- | |
Distributor ID: Debian | |
Description: Debian GNU/Linux 8.6 (jessie) | |
Release: 8.6 | |
Codename: jessie | |
Steps to follow: | |
1) Install ansible | |
$apt-get install ansible | |
2) Install the python pip | |
$apt-get install python-pip | |
3) Install Boto from the Pypi | |
$pip install boto | |
4) Download the ec2.ini and ec2.py to the current directory | |
$wget https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/ec2.ini | |
$wget https://raw.github.com/ansible/ansible/devel/contrib/inventory/ec2.py | |
5) Export the Environmental Varibles | |
Create an IAM user in the AWS and set the policy as admin for demo purpose and enable to access programatically | |
$export AWS_ACCESS_KEY_ID='XXXXXXXXXXXXXX' | |
$export AWS_SECRET_ACCESS_KEY='XXXXXXXXXXX' | |
6) Testing the script for checking the configuration | |
$./ec2.py --list | |
Output | |
--------------- | |
root@ip-10-0-2-87:~/ansible# ./ec2.py --list | |
{ | |
"_meta": { | |
"hostvars": { | |
"xxx.xxx.xxx.xxx": { | |
"ansible_ssh_host": "xxx.xxx.xxx.xxx", | |
"ec2__in_monitoring_element": false, | |
"ec2_account_id": "xxxxxxxxxxx", | |
"ec2_ami_launch_index": "0", | |
"ec2_architecture": "x86_64", | |
"ec2_block_devices": { | |
"xvda": "vol-xxxxxxxxxxxxxxxxx" | |
}, | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment