summaryrefslogtreecommitdiff
path: root/roles/kubernetes/net/kubeguard/reset
diff options
context:
space:
mode:
Diffstat (limited to 'roles/kubernetes/net/kubeguard/reset')
-rw-r--r--roles/kubernetes/net/kubeguard/reset/tasks/main.yml26
1 files changed, 26 insertions, 0 deletions
diff --git a/roles/kubernetes/net/kubeguard/reset/tasks/main.yml b/roles/kubernetes/net/kubeguard/reset/tasks/main.yml
new file mode 100644
index 00000000..d24f9eff
--- /dev/null
+++ b/roles/kubernetes/net/kubeguard/reset/tasks/main.yml
@@ -0,0 +1,26 @@
+---
+- name: check if kubeguard interface service unit exists
+ stat:
+ path: /etc/systemd/system/kubeguard-interfaces.service
+ register: kubeguard_interface_unit
+
+- name: bring down kubeguard interface
+ systemd:
+ name: kubeguard-interfaces.service
+ state: stopped
+ when: kubeguard_interface_unit.stat.exists
+
+- name: gather list of all kubeguard related service units
+ find:
+ path: /etc/systemd/system/
+ patterns:
+ - "kubeguard-peer-*.service"
+ - kubeguard-interfaces.service
+ register: kubeguard_units_installed
+
+- name: remove all kubeguard related files and directories
+ loop: "{{ kubeguard_units_installed.files | map(attribute='path') | list | flatten | union(['/var/lib/kubeguard']) }}"
+ file:
+ path: "{{ item }}"
+ state: absent
+ notify: reload systemd