summaryrefslogtreecommitdiff
path: root/roles/kubernetes/net/tasks/remove.yml
blob: e74f42c12d22470aa0f6313028f35a43c9b59576 (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 kubenet interface service unit exists
  stat:
    path: /etc/systemd/system/kubenet-interfaces.service
  register: kubenet_interface_unit

- name: bring down kubenet interface
  systemd:
    name: kubenet-interfaces.service
    state: stopped
  when: kubenet_interface_unit.stat.exists

- name: gather list of all kubenet related service units
  find:
    path: /etc/systemd/system/
    patterns:
      - "kubenet-peer-*.service"
      - kubenet-interfaces.service
  register: kubenet_units_installed

- name: remove all kubenet related files and directories
  loop: "{{ kubenet_units_installed.files | map(attribute='path') | list | flatten | union(['/var/lib/kubenet']) }}"
  file:
    path: "{{ item }}"
    state: absent
  notify: reload systemd