fix: add k3s reset logic for primary control plane
This commit is contained in:
@@ -28,27 +28,22 @@
|
|||||||
stat:
|
stat:
|
||||||
path: /usr/local/bin/k3s-uninstall.sh
|
path: /usr/local/bin/k3s-uninstall.sh
|
||||||
register: k3s_uninstall_script
|
register: k3s_uninstall_script
|
||||||
when:
|
when: k3s_install_needed
|
||||||
- not (k3s_primary | default(false))
|
|
||||||
- k3s_install_needed
|
|
||||||
|
|
||||||
- name: Reset broken secondary k3s install before rejoin
|
- name: Reset broken k3s install before reinstall
|
||||||
command: /usr/local/bin/k3s-uninstall.sh
|
command: /usr/local/bin/k3s-uninstall.sh
|
||||||
when:
|
when:
|
||||||
- not (k3s_primary | default(false))
|
|
||||||
- k3s_install_needed
|
- k3s_install_needed
|
||||||
- k3s_uninstall_script.stat.exists
|
- k3s_uninstall_script.stat.exists
|
||||||
|
|
||||||
- name: Remove stale k3s data on secondary
|
- name: Remove stale k3s data
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
loop:
|
loop:
|
||||||
- /etc/rancher/k3s
|
- /etc/rancher/k3s
|
||||||
- /var/lib/rancher/k3s
|
- /var/lib/rancher/k3s
|
||||||
when:
|
when: k3s_install_needed
|
||||||
- not (k3s_primary | default(false))
|
|
||||||
- k3s_install_needed
|
|
||||||
|
|
||||||
- name: Download k3s install script
|
- name: Download k3s install script
|
||||||
get_url:
|
get_url:
|
||||||
@@ -68,6 +63,9 @@
|
|||||||
--node-ip={{ k3s_node_ip }}
|
--node-ip={{ k3s_node_ip }}
|
||||||
--tls-san={{ k3s_primary_ip }}
|
--tls-san={{ k3s_primary_ip }}
|
||||||
--tls-san={{ k3s_primary_public_ip }}
|
--tls-san={{ k3s_primary_public_ip }}
|
||||||
|
{% if k3s_disable_embedded_ccm | bool %}--disable-cloud-controller{% endif %}
|
||||||
|
{% if k3s_disable_servicelb | bool %}--disable=servicelb{% endif %}
|
||||||
|
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
||||||
when:
|
when:
|
||||||
- k3s_install_needed
|
- k3s_install_needed
|
||||||
- k3s_primary | default(false)
|
- k3s_primary | default(false)
|
||||||
@@ -86,6 +84,9 @@
|
|||||||
--server https://{{ k3s_primary_ip }}:6443
|
--server https://{{ k3s_primary_ip }}:6443
|
||||||
--advertise-address={{ k3s_node_ip }}
|
--advertise-address={{ k3s_node_ip }}
|
||||||
--node-ip={{ k3s_node_ip }}
|
--node-ip={{ k3s_node_ip }}
|
||||||
|
{% if k3s_disable_embedded_ccm | bool %}--disable-cloud-controller{% endif %}
|
||||||
|
{% if k3s_disable_servicelb | bool %}--disable=servicelb{% endif %}
|
||||||
|
{% if k3s_kubelet_cloud_provider_external | bool %}--kubelet-arg=cloud-provider=external{% endif %}
|
||||||
register: secondary_install
|
register: secondary_install
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
|
|||||||
Reference in New Issue
Block a user