k8s-clusters/ansible/nuke-k3s-cluster.yml

31 lines
871 B
YAML
Raw Normal View History

2022-02-06 15:52:03 -06:00
- name: purge k3s from k3s-nodes
2022-05-25 10:00:19 -05:00
hosts:
- k3s-nodes
- k3s-control-nodes
- k3s-agent-nodes
2022-02-03 14:05:56 -06:00
become: true
2022-02-07 21:07:07 -06:00
gather_facts: no
2022-02-03 14:05:56 -06:00
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 }}"
2022-02-07 21:07:07 -06:00