Giter Club home page Giter Club logo

ansible-dc-ec2-tutorial's Introduction

ansible-dc-ec2-tutorial

This is the source code for a tutorial on using the ec2.py dynamic inventory feature of Ansible. This requires the python boto library for Amazon EC2.

WARNING: terminate_instances.yaml terminates all instances in your cloud account! You have been warned.

Installing:

Install ansible and boto::

pip install -r requirements.txt

Make sure that ec2.py is executable::

chmod a+x inventory/ec2.py

Set AWS_ACCESS_KEY and AWS_SECRET_KEY for Ansible and AWS_SECRET_KEY and AWS_SECRET_ACCESS_KEY for Boto::

export AWS_ACCESS_KEY="AK******************"
export AWS_ACCESS_KEY_ID="AK********************"
export AWS_SECRET_KEY="***************************************"
export AWS_SECRET_ACCESS_KEY="*************************************"

Set the AWS default region::

export AWS_DEFAULT_REGION='us-east-1'

Disable host key checking::

export ANSIBLE_HOST_KEY_CHECKING=False

Sanity test the ec2.py dynamic environment script::

$ cd inventory
$ ./ec2.py --list
{
  "_meta": {
    "hostvars": {}
  }
}
$ cd ..

Note: The ec2.py inventory script fails silently if AWS_ACCESS_KEY_ID is not set.

Galaxy Components:

Grab some external modules from Ansible Galaxy::

mkdir galaxy
$ ansible-galaxy -p galaxy install jdauphant.nginx
- downloading role 'nginx', owned by jdauphant
- downloading role from https://github.com/jdauphant/ansible-role-nginx/archive/v1.1.1.tar.gz
- extracting jdauphant.nginx to galaxy/jdauphant.nginx
- jdauphant.nginx was installed successfully

[ansible-dc-ec2-tutorial] bschott@ironman-2 ~/Source/ansible-dc-ec2-tutorial (master)
$ ansible-galaxy -p galaxy install flmmartins.postgres
- downloading role 'postgres', owned by flmmartins
- downloading role from https://github.com/flmmartins/ansible-postgres/archive/master.tar.gz
- extracting flmmartins.postgres to galaxy/flmmartins.postgres
- flmmartins.postgres was installed successfully

Provisioning Example:

Start the provision_instances playbook::

$ ansible-playbook -i ./inventory provision_instances.yaml

ansible-dc-ec2-tutorial's People

Contributors

electroniceagle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.