blob: ecf39f694e7e9d6c6eaff2c06d19bd1ed9201d4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
---
- name: Fetch the VPC for the vpc.id
ec2_vpc_net_facts:
region: "{{ openshift_aws_region }}"
filters:
"tag:Name": "{{ openshift_aws_clusterid }}"
register: vpcout
- debug:
var: vpcout
verbosity: 1
- when: vpcout.vpcs | length > 0
block:
- name: delete the vpc igw
ec2_vpc_igw:
state: absent
region: "{{ openshift_aws_region }}"
vpc_id: "{{ vpcout.vpcs[0].id }}"
register: igw
- name: delete the vpc subnets
ec2_vpc_subnet:
state: absent
region: "{{ openshift_aws_region }}"
vpc_id: "{{ vpcout.vpcs[0].id }}"
cidr: "{{ item.cidr }}"
az: "{{ item.az }}"
with_items: "{{ openshift_aws_vpc.subnets[openshift_aws_region] }}"
- name: Delete AWS VPC
ec2_vpc_net:
state: absent
region: "{{ openshift_aws_region }}"
name: "{{ openshift_aws_clusterid }}"
cidr_block: "{{ openshift_aws_vpc.cidr }}"
register: vpc
|