Skip to content

Commit aff0feb

Browse files
committed
add when vars defined for object termination
1 parent c22ece4 commit aff0feb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

olvm/terminate_instance.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,51 +41,61 @@
4141
oracle.oci.oci_network_vlan:
4242
vlan_id: "{{ ocid_state.vlan_ocid }}"
4343
state: absent
44+
when: ocid_state.vlan_ocid is defined and ocid_state.vlan_ocid != ''
4445

4546
- name: Delete network_security_group
4647
oracle.oci.oci_network_security_group:
4748
network_security_group_id: "{{ ocid_state.l2_nsg_ocid }}"
4849
state: absent
50+
when: ocid_state.l2_nsg_ocid is defined and ocid_state.l2_nsg_ocid != ''
4951

5052
- name: Delete the subnet2
5153
oracle.oci.oci_network_subnet:
5254
id: "{{ ocid_state.private_subnet_ocid }}"
5355
state: absent
56+
when: ocid_state.private_subnet_ocid is defined and ocid_state.private_subnet_ocid != ''
5457

5558
- name: Delete the subnet1
5659
oracle.oci.oci_network_subnet:
5760
id: "{{ ocid_state.public_subnet_ocid }}"
5861
state: absent
62+
when: ocid_state.public_subnet_ocid is defined and ocid_state.public_subnet_ocid != ''
5963

6064
- name: Delete the security list
6165
oracle.oci.oci_network_security_list:
6266
id: "{{ ocid_state.security_list_ocid }}"
6367
state: absent
68+
when: ocid_state.security_list_ocid is defined and ocid_state.security_list_ocid != ''
6469

6570
- name: Delete the private route table
6671
oracle.oci.oci_network_route_table:
6772
id: "{{ ocid_state.private_route_table_ocid }}"
6873
state: absent
74+
when: ocid_state.private_route_table_ocid is defined and ocid_state.private_route_table_ocid != ''
6975

7076
- name: Delete the public route table
7177
oracle.oci.oci_network_route_table:
7278
id: "{{ ocid_state.public_route_table_ocid }}"
7379
state: absent
80+
when: ocid_state.public_route_table_ocid is defined and ocid_state.public_route_table_ocid != ''
7481

7582
- name: Delete the Service Gateway
7683
oracle.oci.oci_network_service_gateway:
7784
id: "{{ ocid_state.service_gateway_ocid }}"
7885
state: absent
86+
when: ocid_state.service_gateway_ocid is defined and ocid_state.service_gateway_ocid != ''
7987

8088
- name: Delete the Internet Gateway
8189
oracle.oci.oci_network_internet_gateway:
8290
id: "{{ ocid_state.internet_gateway_ocid }}"
8391
state: absent
92+
when: ocid_state.internet_gateway_ocid is defined and ocid_state.internet_gateway_ocid != ''
8493

8594
- name: Delete the VCN
8695
oracle.oci.oci_network_vcn:
8796
vcn_id: "{{ ocid_state.vcn_ocid }}"
8897
state: absent
98+
when: ocid_state.vcn_ocid is defined and ocid_state.vcn_ocid != ''
8999

90100
- name: Prompt user to confirm removal of artifacts
91101
ansible.builtin.pause:

0 commit comments

Comments
 (0)