kubekey/builtin/core/playbooks/delete_cluster.yaml
2025-05-28 10:06:14 +00:00

31 lines
712 B
YAML

---
# load defaults vars
- hosts:
- all
vars_files:
- vars/delete_cluster.yaml
- import_playbook: hook/pre_install.yaml
- hosts:
- k8s_cluster
roles:
- uninstall/kubernetes
- role: uninstall/cri
when: .deleteCRI
post_tasks:
- name: delete localDNS file
ignore_errors: true
command: |
sed -i ':a;$!{N;ba};s@# kubekey hosts BEGIN.*# kubekey hosts END@@' {{ .item }}
sed -i ':a;$!{N;ba};s@# kubekey control_plane BEGIN.*# kubekey control_plane END@@' {{ .item }}
when: .deleteDNS
loop: "{{ .localDNS | toJson }}"
- hosts:
- etcd
roles:
- role: uninstall/etcd
when: .deleteETCD
- import_playbook: hook/post_install.yaml