From bcae7303abfef13113f8bf3f91affe3030dc8540 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 5 Dec 2022 23:57:14 +1300 Subject: [PATCH] k8s destroy --- ansible/roles/k8s_destroy/tasks/main.yaml | 29 ++++++++++++++++------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/ansible/roles/k8s_destroy/tasks/main.yaml b/ansible/roles/k8s_destroy/tasks/main.yaml index b6eb76d..e41b76c 100644 --- a/ansible/roles/k8s_destroy/tasks/main.yaml +++ b/ansible/roles/k8s_destroy/tasks/main.yaml @@ -11,20 +11,31 @@ with_items: - /etc/cni - /etc/kubernetes - - /var/lib/dockershim - /var/lib/etcd - /var/lib/kubelet - /var/run/kubernetes -- name: purge iptables - ansible.builtin.shell: - cmd: | - iptables -F && iptables -X - iptables -t nat -F && iptables -t nat -X - iptables -t raw -F && iptables -t raw -X - iptables -t mangle -F && iptables -t mangle -X +- name: purge iptables rules + ansible.builtin.iptables: + flush: true + table: "{{ item }}" + with_items: + - filter + - raw + - nat + - mangle + +- name: purge iptables chains + ansible.builtin.iptables: + table: "{{ item }}" + state: absent + with_items: + - filter + - raw + - nat + - mangle - name: restart the containerd service ansible.builtin.service: name: containerd - state: restarted \ No newline at end of file + state: reloaded \ No newline at end of file