2019-10-21 14:55:44 +02:00
|
|
|
- block:
|
|
|
|
- name: Make EBS optimized instance in the testing subnet of the test VPC
|
|
|
|
ec2_instance:
|
|
|
|
name: "{{ resource_prefix }}-test-ebs-optimized-instance-in-vpc"
|
|
|
|
image_id: "{{ ec2_ami_image }}"
|
|
|
|
tags:
|
|
|
|
TestId: "{{ resource_prefix }}"
|
|
|
|
security_groups: "{{ sg.group_id }}"
|
|
|
|
vpc_subnet_id: "{{ testing_subnet_b.subnet.id }}"
|
|
|
|
ebs_optimized: true
|
|
|
|
instance_type: t3.nano
|
|
|
|
wait: false
|
|
|
|
register: ebs_opt_in_vpc
|
2018-11-09 13:11:51 +01:00
|
|
|
|
2019-10-21 14:55:44 +02:00
|
|
|
- name: Get ec2 instance info
|
|
|
|
ec2_instance_info:
|
|
|
|
filters:
|
|
|
|
"tag:Name": "{{ resource_prefix }}-test-ebs-optimized-instance-in-vpc"
|
|
|
|
register: ebs_opt_instance_info
|
2018-11-09 13:11:51 +01:00
|
|
|
|
2019-10-21 14:55:44 +02:00
|
|
|
- name: Assert instance is ebs_optimized
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- "{{ ebs_opt_instance_info.instances.0.ebs_optimized }}"
|
2018-11-09 13:11:51 +01:00
|
|
|
|
2019-10-21 14:55:44 +02:00
|
|
|
- name: Terminate instances
|
|
|
|
ec2_instance:
|
|
|
|
instance_ids: "{{ ebs_opt_in_vpc.instance_ids }}"
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: Terminate test-ebs-vols instances
|
|
|
|
ec2_instance:
|
|
|
|
filters:
|
|
|
|
"tag:Name": "{{ resource_prefix }}-test-ebs-optimized-instance-in-vpc"
|
|
|
|
state: absent
|
|
|
|
wait: false
|
|
|
|
ignore_errors: yes
|