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