Fix label syntax;Add retries;Sort list;Housekeeping
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a020ac0e15
commit
6d5b8e2d96
@ -63,14 +63,14 @@
|
||||
jq -r '.Tags[0]'
|
||||
chdir: /opt/metacluster/container-images
|
||||
register: registry_artifacts
|
||||
loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/container-images/*.tar') }}"
|
||||
loop: "{{ query('ansible.builtin.fileglob', '/opt/metacluster/container-images/*.tar') | sort }}"
|
||||
loop_control:
|
||||
label: "{{ item | basename }}"
|
||||
|
||||
- name: Get source registries of all artifacts
|
||||
ansible.builtin.set_fact:
|
||||
source_registries: "{{ (source_registries | default([]) + [(item | split('/'))[0]]) | unique | sort }}"
|
||||
loop: "{{ registry_artifacts | json_query('results[*].stdout') | select }}"
|
||||
loop: "{{ registry_artifacts | json_query('results[*].stdout') | select | sort }}"
|
||||
|
||||
- name: Configure K3s node for private registry
|
||||
ansible.builtin.template:
|
||||
|
@ -71,5 +71,13 @@
|
||||
definition:
|
||||
metadata:
|
||||
labels:
|
||||
vm_id: "{{ moref_id }}"
|
||||
ova.airgappedk8s/moref_id: "{{ moref_id }}"
|
||||
kubeconfig: "{{ kubeconfig.path }}"
|
||||
register: patch_result
|
||||
until:
|
||||
- patch_result is not failed
|
||||
retries: "{{ playbook.retries }}"
|
||||
delay: "{{ playbook.delay.short }}"
|
||||
|
||||
- debug:
|
||||
msg: "{{ patch_result }}"
|
||||
|
@ -1,12 +1,12 @@
|
||||
- name: Cordon node
|
||||
kubernetes.core.k8s_drain:
|
||||
name: "{{ decom_node }}"
|
||||
name: "{{ decom_nodename }}"
|
||||
state: cordon
|
||||
kubeconfig: "{{ kubeconfig.path }}"
|
||||
|
||||
- name: Drain node
|
||||
kubernetes.core.k8s_drain:
|
||||
name: "{{ decom_node }}"
|
||||
name: "{{ decom_nodename }}"
|
||||
state: drain
|
||||
delete_options:
|
||||
ignore_daemonsets: true
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
- name: Delete node
|
||||
kubernetes.core.k8s:
|
||||
name: "{{ decom_node }}"
|
||||
name: "{{ decom_nodename }}"
|
||||
kind: node
|
||||
state: absent
|
||||
wait: true
|
||||
|
@ -1,15 +1,15 @@
|
||||
- name: Lookup node name and moref id for decommissioning
|
||||
- name: Lookup node name and moref-id for decommissioning
|
||||
ansible.builtin.set_fact:
|
||||
decom_node: >-
|
||||
decom_nodename: >-
|
||||
{{
|
||||
lookup('kubernetes.core.k8s', kind='Node', kubeconfig=(kubeconfig.path)) |
|
||||
json_query('[? metadata.name != `' ~ ansible_facts.nodename ~ '`].metadata.name') |
|
||||
first
|
||||
}}
|
||||
decom_vmid: >-
|
||||
decom_morefid: >-
|
||||
{{
|
||||
lookup('kubernetes.core.k8s', kind='Node', kubeconfig=(kubeconfig.path)) |
|
||||
json_query('[? metadata.name != `' ~ ansible_facts.nodename ~ '`].metadata.labels.vm_id') |
|
||||
json_query('[? metadata.name != `' ~ ansible_facts.nodename ~ '`].metadata.labels."ova.airgappedk8s/moref_id"') |
|
||||
first
|
||||
}}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
- name: Disable disk scheduling and evict replicas
|
||||
kubernetes.core.k8s:
|
||||
name: "{{ decom_node }}"
|
||||
name: "{{ decom_nodename }}"
|
||||
namespace: longhorn-system
|
||||
kind: nodes.longhorn.io
|
||||
state: patched
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
- name: Lookup VM name
|
||||
community.vmware.vmware_guest_info:
|
||||
moid: "{{ decom_vmid }}"
|
||||
moid: "{{ decom_morefid }}"
|
||||
register: virtualmachine_details
|
||||
|
||||
- name: Power off VM
|
||||
|
@ -71,5 +71,10 @@
|
||||
definition:
|
||||
metadata:
|
||||
labels:
|
||||
vm_id: "{{ moref_id }}"
|
||||
ova.airgappedk8s/moref_id: "{{ moref_id }}"
|
||||
kubeconfig: "{{ kubeconfig.path }}"
|
||||
register: patch_result
|
||||
until:
|
||||
- patch_result is not failed
|
||||
retries: "{{ playbook.retries }}"
|
||||
delay: "{{ playbook.delay.short }}"
|
||||
|
Loading…
Reference in New Issue
Block a user