Commit 13d7fd75 by John Jarvis

fixing names of tasks in launch_ec2

parent f0348d2e
# Launches an ec2 instance and blocks until the instance is up # Launches an ec2 instance and blocks until the instance is up
# adds it to the host group # adds it to the host group
# Will terminate an instance if one and only one already exists # Will terminate an instance if one and only one already exists
# with the same name # with the same name
- name: lookup tags for terminating existing instance - name: launch_ec2 | lookup tags for terminating existing instance
local_action: local_action:
module: ec2_lookup module: ec2_lookup
region: "{{ region }}" region: "{{ region }}"
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
register: tag_lookup register: tag_lookup
when: terminate_instance == true when: terminate_instance == true
- debug: msg="Too many results returned, not terminating!" - name: launch_ec2 | checking for other instances
debug: msg="Too many results returned, not terminating!"
when: terminate_instance == true and tag_lookup.instance_ids|length > 1 when: terminate_instance == true and tag_lookup.instance_ids|length > 1
- name: terminating single instance - name: terminating single instance
...@@ -23,14 +24,14 @@ ...@@ -23,14 +24,14 @@
instance_ids: ${tag_lookup.instance_ids} instance_ids: ${tag_lookup.instance_ids}
when: terminate_instance == true and tag_lookup.instance_ids|length == 1 when: terminate_instance == true and tag_lookup.instance_ids|length == 1
- name: launch_ec2 | Launch ec2 instance - name: launch_ec2 | Launch ec2 instance
local_action: local_action:
module: ec2 module: ec2
keypair: "{{ keypair }}" keypair: "{{ keypair }}"
group: "{{ security_group }}" group: "{{ security_group }}"
instance_type: "{{ instance_type }}" instance_type: "{{ instance_type }}"
image: "{{ ami }}" image: "{{ ami }}"
wait: true wait: true
region: "{{ region }}" region: "{{ region }}"
instance_tags: "{{instance_tags}}" instance_tags: "{{instance_tags}}"
root_ebs_size: "{{ root_ebs_size }}" root_ebs_size: "{{ root_ebs_size }}"
...@@ -75,17 +76,17 @@ ...@@ -75,17 +76,17 @@
- name: launch_ec2 | Add new instance to host group - name: launch_ec2 | Add new instance to host group
local_action: > local_action: >
add_host add_host
hostname={{ item.public_ip }} hostname={{ item.public_ip }}
groupname=launched groupname=launched
with_items: "{{ ec2.instances }}" with_items: "{{ ec2.instances }}"
- name: launch_ec2 | Wait for SSH to come up - name: launch_ec2 | Wait for SSH to come up
local_action: > local_action: >
wait_for wait_for
host={{ item.public_dns_name }} host={{ item.public_dns_name }}
state=started state=started
port=22 port=22
delay=60 delay=60
timeout=320 timeout=320
with_items: "{{ 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