-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall.yml
More file actions
27 lines (23 loc) · 759 Bytes
/
Copy pathuninstall.yml
File metadata and controls
27 lines (23 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
- name: Run the k3s uninstall script
ansible.builtin.command: /usr/local/bin/k3s-uninstall.sh
args:
removes: /usr/local/bin/k3s # skip if the binary is already gone
- name: Remove k3s config and data directories
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- /etc/rancher
- /var/lib/rancher
- name: Remove kubeconfig
ansible.builtin.file:
path: "/home/{{ k3s_user }}/.kube/config"
state: absent
- name: Confirm the k3s binary is removed
ansible.builtin.stat:
path: /usr/local/bin/k3s
register: k3s_binary
- name: Print the uninstall result
ansible.builtin.debug:
msg: "{{ 'k3s uninstalled successfully' if not k3s_binary.stat.exists else 'k3s is still present, uninstall failed' }}"