Skip to content

Commit a858b03

Browse files
committed
feat/destroy: add OCI destroy resources
1 parent 2994985 commit a858b03

File tree

7 files changed

+30
-14
lines changed

7 files changed

+30
-14
lines changed

playbooks/destroy_cluster.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- name: OKD Installer | Destroy | Timer start
99
ansible.builtin.set_fact:
1010
okdi_del_timer_start: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}"
11+
tags: all
1112

1213
# - ansible.builtin.import_playbook: var_check_required.yaml
1314

@@ -31,43 +32,52 @@
3132
- name: okd-installer | Destroy | Network | Loading Topology Names
3233
ansible.builtin.include_vars:
3334
file: "{{ profile_path }}/network.yaml"
35+
tags: all
3436

3537
# Load Balancers
3638
- name: okd-installer | Destroy | LB | Init list
3739
ansible.builtin.set_fact:
3840
load_balancers_all: []
41+
tags: all
3942

4043
- name: okd-installer | Destroy | Load Resource Names
4144
ansible.builtin.include_vars:
4245
file: "{{ profile_path }}/destroy_resources.yaml"
46+
tags: all
4347

44-
- name: okd-installer | Destroy | LB | Load Router Names
48+
- name: okd-installer | Destroy | LB | Load LB Names
4549
ansible.builtin.include_vars:
4650
file: "{{ profile_path }}/loadbalancer-router-default.yaml"
51+
tags: all
4752

48-
- name: okd-installer | Destroy | LB | Merge list
53+
- name: okd-installer | Destroy | LB | Merge list w/ router
4954
ansible.builtin.set_fact:
50-
load_balancers_all: "{{ load_balancers_all + cloud_loadbalancers }}"
55+
load_balancers_all: "{{ (load_balancers_all | d([])) + (cloud_loadbalancers | d([])) }}"
56+
tags: all
5157

5258
- name: okd-installer | Destroy | LB | Load API Names
5359
ansible.builtin.include_vars:
5460
file: "{{ profile_path }}/loadbalancer.yaml"
61+
tags: all
5562

5663
- name: okd-installer | Destroy | LB | Merge list
5764
ansible.builtin.set_fact:
58-
load_balancers_all: "{{ load_balancers_all + cloud_loadbalancers }}"
65+
load_balancers_all: "{{ load_balancers_all + (cloud_loadbalancers | d([])) }}"
66+
tags: all
5967

6068
- name: okd-installer | Destroy | LB | Consolidate
6169
ansible.builtin.set_fact:
6270
cloud_loadbalancers: "{{ load_balancers_all }}"
71+
tags: all
6372

6473
- name: okd-installer | Destroy | LB | Show number of resources
6574
ansible.builtin.debug:
6675
msg: "Found {{ cloud_loadbalancers | length }} Load Balancers on the Configuration"
76+
tags: all
6777

6878
roles:
6979
- role: destroy
70-
80+
tags: all
7181

7282
- name: okd-installer | Destroy | Finish
7383
hosts: '{{ target|default("localhost") }}'
@@ -77,9 +87,11 @@
7787
- name: okd-installer | Destroy | Finish | Timer end
7888
ansible.builtin.set_fact:
7989
okdi_del_timer_end: "{{ ansible_date_time.date }} {{ ansible_date_time.time }}"
90+
tags: all
8091

8192
- name: okd-installer | Destroy | Finish | Show timers
8293
ansible.builtin.debug:
8394
msg:
8495
- "start=[{{ okdi_del_timer_start | d('') }}] end=[{{ okdi_del_timer_end }}]"
8596
- "total=[{{ ((okdi_del_timer_end | to_datetime) - (okdi_del_timer_start | to_datetime)) }}]"
97+
tags: all

playbooks/vars/oci/profiles/ha/dns.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ cloud_dns_zones:
1111
# zone_type: PRIMARY
1212
compartment_id: "{{ oci_compartment_id_dns | d(oci_compartment_id) }}"
1313

14+
# OCI is using subnet's zone.
15+
# TODO: Need to check if will not conflict with custom private zone.
16+
# Currently the cluster is resolving the DNS using the public zone.
1417
# private
1518
# - name: "{{ cluster_state.dns.cluster_domain }}"
1619
# provider: oci

playbooks/vars/oci/profiles/ha/network.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ cloud_networks:
8686
# network_entity_type: nat-gateway
8787
# network_entity_name: "{{ cluster_state.infra_id }}-natgw"
8888

89-
9089
# create permissive security Lists to force to use NSGs
9190
# https://docs.oracle.com/en-us/iaas/tools/oci-ansible-collection/4.12.0/collections/oracle/oci/oci_network_security_list_module.html#ansible-collections-oracle-oci-oci-network-security-list-module
9291
security_lists:

roles/bootstrap/tasks/oci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
# https://docs.oracle.com/en-us/iaas/tools/oci-ansible-collection/4.12.0/collections/oracle/oci/oci_object_storage_object_module.html#ansible-collections-oracle-oci-oci-object-storage-object-module
33
# https://docs.oracle.com/en-us/iaas/tools/oci-ansible-collection/4.12.0/collections/oracle/oci/oci_object_storage_object_module.html#ansible-collections-oracle-oci-oci-object-storage-object-module
44

5-
- name: Get a specific namespace
5+
- name: OCI | Get the namespace
66
oracle.oci.oci_object_storage_namespace_facts:
77
compartment_id: "{{ oci_compartment_id }}"
88
register: _objns
99

1010
- debug: var=_objns
1111

12-
- name: Create bucket
12+
- name: OCI | Create bucket
1313
oracle.oci.oci_object_storage_bucket:
1414
compartment_id: "{{ oci_compartment_id }}"
1515
name: "{{ bootstrap_bucket }}"
1616
namespace_name: "{{ _objns.namespace }}"
1717
state: present
1818

1919
# TODO: Make it indepotent
20-
- name: Upload bootstrap.ign
20+
- name: OCI | Upload bootstrap.ign
2121
oracle.oci.oci_object_storage_object:
2222
namespace_name: "{{ _objns.namespace }}"
2323
bucket_name: "{{ bootstrap_bucket }}"
@@ -26,7 +26,7 @@
2626
force: false
2727
register: _upload
2828

29-
- name: OCI | Create expieration timestamp
29+
- name: OCI | Create expiration timestamp
3030
ansible.builtin.command: "date +'%Y-%m-%dT%H:%M:%S%z' -d '+1 hour'"
3131
register: _cmd
3232
changed_when: false

roles/clients/tasks/main.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
- name: openshift-install | Download msg
3636
ansible.builtin.debug:
37-
msg: "Donwloading tools [{{ release_image_version_arch | d(local_version) }}] using secret [{{ config_pull_secret_file }}]"
37+
msg: "Downloading tools [{{ release_image_version_arch | d(local_version) }}] using secret [{{ config_pull_secret_file }}]"
3838
when: not(check_tar_inst.stat.exists)
3939

4040
- name: openshift-install | Check vars
@@ -142,7 +142,9 @@
142142

143143
- name: Show clients path
144144
ansible.builtin.debug:
145-
msg: "binary=[{{ item.src }}] link=[{{ item.link }}]"
145+
msg:
146+
- "binary=[{{ collection_bin_dir }}/{{ item.src }}]"
147+
- "link=[{{ collection_bin_dir }}/{{ item.link }}]"
146148
with_items:
147149
- src: "{{ bin_installer }}"
148150
link: openshift-install

roles/cloud_compute

roles/cloud_load_balancer

0 commit comments

Comments
 (0)