Commit 51ebc4ee authored by Dave Johnson's avatar Dave Johnson
Browse files

Added a playbook for provisioning to AWS

parent d8333d6d
---
- name: Provision instances
hosts: localhost
connection: local
gather_facts: False
# load AWS variables from this group vars file
vars_files:
- group_vars/all
tasks:
- name: Launch instances
ec2:
access_key: "{{ ec2_access_key }}"
secret_key: "{{ ec2_secret_key }}"
keypair: "{{ ec2_keypair }}"
group: "{{ ec2_security_group }}"
type: "{{ ec2_instance_type }}"
image: "{{ ec2_image }}"
region: "{{ ec2_region }}"
instance_tags: "{'ansible_group':'jboss', 'type':'{{ ec2_instance_type }}', 'group':'{{ ec2_security_group }}', 'Name':'demo_''{{ tower_user_name }}'}"
count: "{{ ec2_instance_count }}"
wait: true
register: ec2
- name: Wait for SSH to come up
wait_for:
host: {{ item.public_dns_name }}
port: 22
delay: 60
timeout: 320
state: started
with_items: "{{ ec2.instances }}""
......@@ -2,3 +2,21 @@
http_port: 8080
https_port: 8443
# AWS specific variables
ec2_access_key:
ec2_secret_key:
ec2_region: us-east-1
ec2_zone:
ec2_image: ami-6c1e8f04
ec2_instance_type: m1.small
ec2_keypair: djohnson
ec2_security_group: default
ec2_instance_count: 3
ec2_tag: demo
ec2_tag_name_prefix: dj
ec2_hosts: all
wait_for_port: 22
# This user name will be set by Tower, when run through Tower
tower_user_name: admin
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment