mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 14:44:32 +00:00
- Ensure k3s mode uses the k3s registry endpoint and avoid localhost/k3d image prefixes. - Make ArgoCD repo-server cmp symlink creation idempotent. - Normalize common-core provisioning to knoe-system and add repair-time dedupe of stray default-namespace installs. - Add k3s MariaDB datastore/refresh playbooks and regression tests.
86 lines
2.5 KiB
YAML
86 lines
2.5 KiB
YAML
---
|
|
|
|
- name: Set effective k3s data-dir
|
|
ansible.builtin.set_fact:
|
|
k3s_effective_data_dir: "{{ k3s_data_dir | default('/var/lib/rancher/k3s', true) }}"
|
|
|
|
- name: Best-effort purge kube-system workloads before uninstall
|
|
ansible.builtin.command: "kubectl -n kube-system delete all --all --ignore-not-found"
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- name: Best-effort purge kube-system namespaces
|
|
ansible.builtin.command: "kubectl delete namespace kube-system --ignore-not-found"
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- name: Force-remove kube-system finalizers if namespace is stuck
|
|
ansible.builtin.command: "kubectl patch namespace kube-system -p '{\"spec\":{\"finalizers\":[]}}' --type=merge"
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- name: Stop k3s services if present
|
|
ansible.builtin.service:
|
|
name: "{{ item }}"
|
|
state: stopped
|
|
enabled: false
|
|
loop:
|
|
- k3s
|
|
- k3s-agent
|
|
failed_when: false
|
|
|
|
- name: Check for k3s uninstall scripts
|
|
ansible.builtin.stat:
|
|
path: "{{ item }}"
|
|
loop:
|
|
- /usr/local/bin/k3s-uninstall.sh
|
|
- /usr/local/bin/k3s-agent-uninstall.sh
|
|
register: k3s_uninstall_scripts
|
|
|
|
- name: Run k3s uninstall scripts if present
|
|
ansible.builtin.command: "{{ item.stat.path }}"
|
|
loop: "{{ k3s_uninstall_scripts.results }}"
|
|
when: item.stat.exists
|
|
|
|
- name: Remove k3s systemd units and directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- /etc/rancher
|
|
- /etc/systemd/system/k3s.service
|
|
- /etc/systemd/system/k3s-agent.service
|
|
- /etc/systemd/system/k3s.service.d
|
|
- /etc/systemd/system/k3s-agent.service.d
|
|
- /etc/rancher/node
|
|
- /etc/rancher/k3s
|
|
- /etc/cni
|
|
- /opt/cni
|
|
- "{{ k3s_effective_data_dir }}"
|
|
- "{{ k3s_effective_data_dir }}/server/tls"
|
|
- "{{ k3s_effective_data_dir }}/server/cred"
|
|
- "{{ k3s_effective_data_dir }}/server/token"
|
|
- "{{ k3s_effective_data_dir }}/server/node-token"
|
|
- "{{ k3s_effective_data_dir }}/server/agent-token"
|
|
- "{{ k3s_effective_data_dir }}/server/db"
|
|
- "{{ k3s_effective_data_dir }}/agent"
|
|
- "{{ k3s_effective_data_dir }}/data"
|
|
- /var/lib/kubelet
|
|
- /var/lib/etcd
|
|
- /var/lib/cni
|
|
- /var/lib/containerd
|
|
- /run/k3s
|
|
- /run/flannel
|
|
- /var/log/k3s
|
|
- /usr/local/bin/k3s
|
|
- /usr/local/bin/k3s-killall.sh
|
|
- /usr/local/bin/k3s-uninstall.sh
|
|
- /usr/local/bin/k3s-agent-uninstall.sh
|
|
- /usr/local/bin/kubectl
|
|
- /usr/local/bin/crictl
|
|
- /usr/local/bin/ctr
|
|
|
|
- name: Reload systemd after k3s cleanup
|
|
ansible.builtin.systemd:
|
|
daemon_reload: true
|