ansible/test/integration/targets/ec2_metric_alarm/tasks/env_cleanup.yml
Tad Merchant 493ec588ab Ec2 metric alarm boto3 and treat missing data (#62669)
* Converted ec2_metric_alarm to boto3. Added treat_missing_data option.

* Handle potentially non-existent alarm keys in ec2_metric_alarm module

* Add treat missing data to ec2_metric_alarms wth some tests

Continues the work of #23407

* Clean up ec2_metric_alarm main test playbook

* fix test suite and sanity checks

* more fixes for sanity tests

* fixes to ec2_metric_alarms requested in code review

* import ClientError from botocore, catch generic ClientError

* more fixes from review

drops extra dict in argument spec and set_facts for aws access

* Fix pep8 blank line issue

* switch to fail_json_aws, add idempotency test

* fix under indented continuation

* remove unsupported alias

* Add group to ec2_metric_alarm aliases

* Put alarm prefix before resource prefix to match aws-terminator pr 63

* Add type for treat_missing_data
2019-12-12 14:09:09 -07:00

94 lines
2.1 KiB
YAML

- name: remove any instances in the test VPC
ec2_instance:
filters:
vpc_id: "{{ testing_vpc.vpc.id }}"
state: absent
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10
- name: remove ENIs
ec2_eni_info:
filters:
vpc-id: "{{ testing_vpc.vpc.id }}"
register: enis
- name: delete all ENIs
ec2_eni:
eni_id: "{{ item.id }}"
state: absent
until: removed is not failed
with_items: "{{ enis.network_interfaces }}"
ignore_errors: yes
retries: 10
- name: remove the security group
ec2_group:
name: "{{ resource_prefix }}-sg"
description: a security group for ansible tests
vpc_id: "{{ testing_vpc.vpc.id }}"
state: absent
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10
- name: remove routing rules
ec2_vpc_route_table:
state: absent
vpc_id: "{{ testing_vpc.vpc.id }}"
tags:
created: "{{ resource_prefix }}-route"
routes:
- dest: 0.0.0.0/0
gateway_id: "{{ igw.gateway_id }}"
subnets:
- "{{ testing_subnet_a.subnet.id }}"
- "{{ testing_subnet_b.subnet.id }}"
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10
- name: remove internet gateway
ec2_vpc_igw:
vpc_id: "{{ testing_vpc.vpc.id }}"
state: absent
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10
- name: remove subnet A
ec2_vpc_subnet:
state: absent
vpc_id: "{{ testing_vpc.vpc.id }}"
cidr: 10.22.32.0/24
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10
- name: remove subnet B
ec2_vpc_subnet:
state: absent
vpc_id: "{{ testing_vpc.vpc.id }}"
cidr: 10.22.33.0/24
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10
- name: remove the VPC
ec2_vpc_net:
name: "{{ resource_prefix }}-vpc"
cidr_block: 10.22.32.0/23
state: absent
tags:
Name: Ansible Testing VPC
tenancy: default
register: removed
until: removed is not failed
ignore_errors: yes
retries: 10