31 lines
871 B
YAML
31 lines
871 B
YAML
- name: purge k3s from k3s-nodes
|
|
hosts:
|
|
- k3s-nodes
|
|
- k3s-control-nodes
|
|
- k3s-agent-nodes
|
|
become: true
|
|
gather_facts: no
|
|
any_errors_fatal: true
|
|
tasks:
|
|
- name: Kill k3s
|
|
ansible.builtin.command: /usr/local/bin/k3s-killall.sh
|
|
- name: Uninstall k3s
|
|
ansible.builtin.command:
|
|
cmd: /usr/local/bin/k3s-uninstall.sh
|
|
removes: /usr/local/bin/k3s-uninstall.sh
|
|
- name: Uninstall k3s agent
|
|
ansible.builtin.command:
|
|
cmd: /usr/local/bin/k3s-agent-uninstall.sh
|
|
removes: /usr/local/bin/k3s-agent-uninstall.sh
|
|
- name: Gather list of CNI files to delete
|
|
find:
|
|
paths: /etc/cni/net.d
|
|
patterns: "*"
|
|
register: files_to_delete
|
|
- name: Delete CNI files
|
|
ansible.builtin.file:
|
|
path: "{{ item.path }}"
|
|
state: absent
|
|
loop: "{{ files_to_delete.files }}"
|
|
|