1
0
IaC/ansible/roles/k8s_destroy/tasks/main.yaml
2022-12-06 00:16:54 +13:00

41 lines
728 B
YAML

---
- name: reset the nodes
ansible.builtin.shell:
cmd: |
kubeadm reset -f
- name: delete orphaned files
ansible.builtin.file:
path: "{{ item }}"
state: absent
with_items:
- /etc/cni
- /etc/kubernetes
- /var/lib/etcd
- /var/lib/kubelet
- /var/run/kubernetes
- name: purge iptables rules
ansible.builtin.iptables:
flush: true
table: "{{ item }}"
with_items:
- filter
- raw
- nat
- mangle
- name: purge iptables chains
ansible.builtin.shell:
cmd: |
iptables -t {{ item }} -X
with_items:
- filter
- raw
- nat
- mangle
- name: restart the containerd service
ansible.builtin.service:
name: containerd
state: reloaded