Commit 09f214d0 by John Jarvis

This adds termination support to the ec2 module

parent ec0fd2ed
- name: Create sandbox instance - name: Create sandbox instance
hosts: localhost hosts: localhost
connection: local connection: local
user: root
sudo: False
gather_facts: False gather_facts: False
vars: vars:
keypair: continuous-integration keypair: continuous-integration
instance_type: m1.large instance_type: m1.large
security_group: sandbox security_group: sandbox
image: ami-d0f89fb9 image: ami-d0f89fb9
region: us-east-1 region: us-east-1
tasks:
roles: - name: Launch instance
- 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) - name: Configure instance(s)
hosts: launched hosts: launched
...@@ -24,8 +28,16 @@ ...@@ -24,8 +28,16 @@
vars_files: vars_files:
- "{{ secure_dir }}/vars/edxapp_ref_users.yml" - "{{ secure_dir }}/vars/edxapp_ref_users.yml"
- "{{ secure_dir }}/vars/edxapp_sandbox.yml" - "{{ secure_dir }}/vars/edxapp_sandbox.yml"
roles: tasks:
- common command: true
- nginx
- edxlocal
- edxapp - 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