Commit 36b87a80 by John Jarvis

using set_fact to remember launch and termination ids

parent 8f9d8fc0
......@@ -33,22 +33,14 @@
# in as a -e variable
- gh_users
post_tasks:
- name: get instance id for elb registration
local_action:
module: ec2_lookup
region: us-east-1
tags:
Name: "{{ name_tag }}"
register: ec2_info
when: elb
sudo: False
- name: register instance into an elb if one was provided
local_action:
module: ec2_elb
region: "{{ region }}"
instance_id: "{{ ec2_info.instance_ids[0] }}"
instance_id: "{{ item }}"
state: present
ec2_elbs:
- "{{ elb }}"
when: elb
sudo: False
with_items: "{{ launch_ids }}"
......@@ -16,6 +16,11 @@
debug: msg="Too many results returned, not terminating!"
when: terminate_instance == true and tag_lookup.instance_ids|length > 1
- name: launch_ec2 | remember the instance id of the terminated instance
set_fact:
termination_ids: ${tag_lookup.instance_ids}
when: terminate_instance == true
- name: terminating single instance
local_action:
module: ec2
......@@ -38,6 +43,10 @@
zone: "{{ zone }}"
register: ec2
- name: launch_ec2 | remember the instance id of the launched instances
set_fact:
launch_ids: ${ec2.instances}
- name: launch_ec2 | Add DNS name
local_action:
module: route53
......
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