Commit c4493217 by John Jarvis

only terminate if the instance count is one

parent b26235a2
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
tags: tags:
Name: "{{ name_tag }}" Name: "{{ name_tag }}"
register: tag_lookup register: tag_lookup
- fail: 'Too many results returned, not terminating!' - debug: msg="Too many results returned, not terminating!"
when: tag_lookup.instance_ids|length > 1 when: tag_lookup.instance_ids|length > 1
- ec2: - ec2:
state: 'absent' state: 'absent'
region: "{{ region }}" region: "{{ region }}"
instance_ids: ${tag_lookup.instance_ids} instance_ids: ${tag_lookup.instance_ids}
when: tag_lookup.instance_ids|length == 1
roles: roles:
- role: launch_ec2 - role: launch_ec2
keypair: "{{ keypair }}" keypair: "{{ keypair }}"
......
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