Commit 09f214d0 by John Jarvis

This adds termination support to the ec2 module

parent ec0fd2ed
- name: Create sandbox instance
hosts: localhost
connection: local
user: root
sudo: False
gather_facts: False
vars:
keypair: continuous-integration
instance_type: m1.large
security_group: sandbox
image: ami-d0f89fb9
region: us-east-1
roles:
- launch_instance
tasks:
- name: Launch instance
local_action: ec2 keypair=$keypair group=$security_group instance_type=$instance_type image=$image wait=true region=$region count=2
register: ec2
- name: Add new instance to host group
local_action: add_host hostname=${item.public_ip} groupname=launched
with_items: ${ec2.instances}
- name: Wait for SSH to come up
local_action: wait_for host=${item.public_dns_name} port=22 delay=60 timeout=320 state=started
with_items: ${ec2.instances}
- name: Configure instance(s)
hosts: launched
......@@ -24,8 +28,16 @@
vars_files:
- "{{ secure_dir }}/vars/edxapp_ref_users.yml"
- "{{ secure_dir }}/vars/edxapp_sandbox.yml"
roles:
- common
- nginx
- edxlocal
- edxapp
tasks:
command: true
- name: Terminate instances
hosts: localhost
connection: local
tasks:
- name: Terminate instances that were previously launched
local_action:
module: ec2
termination_list: ${ec2.instances}
# with_items: ${ec2.instances}
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