|
41 | 41 | oracle.oci.oci_network_vlan:
|
42 | 42 | vlan_id: "{{ ocid_state.vlan_ocid }}"
|
43 | 43 | state: absent
|
| 44 | + when: ocid_state.vlan_ocid is defined and ocid_state.vlan_ocid != '' |
44 | 45 |
|
45 | 46 | - name: Delete network_security_group
|
46 | 47 | oracle.oci.oci_network_security_group:
|
47 | 48 | network_security_group_id: "{{ ocid_state.l2_nsg_ocid }}"
|
48 | 49 | state: absent
|
| 50 | + when: ocid_state.l2_nsg_ocid is defined and ocid_state.l2_nsg_ocid != '' |
49 | 51 |
|
50 | 52 | - name: Delete the subnet2
|
51 | 53 | oracle.oci.oci_network_subnet:
|
52 | 54 | id: "{{ ocid_state.private_subnet_ocid }}"
|
53 | 55 | state: absent
|
| 56 | + when: ocid_state.private_subnet_ocid is defined and ocid_state.private_subnet_ocid != '' |
54 | 57 |
|
55 | 58 | - name: Delete the subnet1
|
56 | 59 | oracle.oci.oci_network_subnet:
|
57 | 60 | id: "{{ ocid_state.public_subnet_ocid }}"
|
58 | 61 | state: absent
|
| 62 | + when: ocid_state.public_subnet_ocid is defined and ocid_state.public_subnet_ocid != '' |
59 | 63 |
|
60 | 64 | - name: Delete the security list
|
61 | 65 | oracle.oci.oci_network_security_list:
|
62 | 66 | id: "{{ ocid_state.security_list_ocid }}"
|
63 | 67 | state: absent
|
| 68 | + when: ocid_state.security_list_ocid is defined and ocid_state.security_list_ocid != '' |
64 | 69 |
|
65 | 70 | - name: Delete the private route table
|
66 | 71 | oracle.oci.oci_network_route_table:
|
67 | 72 | id: "{{ ocid_state.private_route_table_ocid }}"
|
68 | 73 | state: absent
|
| 74 | + when: ocid_state.private_route_table_ocid is defined and ocid_state.private_route_table_ocid != '' |
69 | 75 |
|
70 | 76 | - name: Delete the public route table
|
71 | 77 | oracle.oci.oci_network_route_table:
|
72 | 78 | id: "{{ ocid_state.public_route_table_ocid }}"
|
73 | 79 | state: absent
|
| 80 | + when: ocid_state.public_route_table_ocid is defined and ocid_state.public_route_table_ocid != '' |
74 | 81 |
|
75 | 82 | - name: Delete the Service Gateway
|
76 | 83 | oracle.oci.oci_network_service_gateway:
|
77 | 84 | id: "{{ ocid_state.service_gateway_ocid }}"
|
78 | 85 | state: absent
|
| 86 | + when: ocid_state.service_gateway_ocid is defined and ocid_state.service_gateway_ocid != '' |
79 | 87 |
|
80 | 88 | - name: Delete the Internet Gateway
|
81 | 89 | oracle.oci.oci_network_internet_gateway:
|
82 | 90 | id: "{{ ocid_state.internet_gateway_ocid }}"
|
83 | 91 | state: absent
|
| 92 | + when: ocid_state.internet_gateway_ocid is defined and ocid_state.internet_gateway_ocid != '' |
84 | 93 |
|
85 | 94 | - name: Delete the VCN
|
86 | 95 | oracle.oci.oci_network_vcn:
|
87 | 96 | vcn_id: "{{ ocid_state.vcn_ocid }}"
|
88 | 97 | state: absent
|
| 98 | + when: ocid_state.vcn_ocid is defined and ocid_state.vcn_ocid != '' |
89 | 99 |
|
90 | 100 | - name: Prompt user to confirm removal of artifacts
|
91 | 101 | ansible.builtin.pause:
|
|
0 commit comments