k3s-ansible/playbook/reset.yml

20 lines
587 B
YAML

---
- name: Undo cluster setup
hosts: k3s_cluster
become: true
tasks:
- name: Run K3s Uninstall script [server]
when: "'server' in group_names"
ansible.builtin.command:
cmd: k3s-uninstall.sh
removes: /var/lib/rancher/k3s/*
- name: Run K3s Uninstall script [agent]
when: "'agent' in group_names"
ansible.builtin.command:
cmd: k3s-agent-uninstall.sh
removes: /var/lib/rancher/k3s/*
- name: Remove user kubeconfig
ansible.builtin.file:
path: /home/{{ ansible_user }}/.kube/config
state: absent