summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/reset/tasks/net_kubeguard.yml
blob: bcb489605f24fcc64b71199a58872b07fc086bcc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
---
- name: check if kubeguard interface service unit exists
  stat:
    path: /etc/systemd/system/kubeguard-interface.service
  register: kubeguard_interface_unit

- name: bring down kubeguard interface
  when: kubeguard_interface_unit.stat.exists
  systemd:
    name: kubeguard-interface.service
    state: stopped

- name: gather list of all kubeguard related service units
  find:
    path: /etc/systemd/system/
    patterns:
    - "kubeguard-peer-*.service"
    - kubeguard-interface.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