summaryrefslogtreecommitdiff
path: root/roles/kubernetes-net/tasks/remove.yaml
blob: 6695bd5d22c1cf23e69519bb5f658afdbf561c8e (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
27
28
---
- 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
  with_flattened:
  - "{{ kubenet_units_installed.files | map(attribute='path') | list }}"
  - /var/lib/kubenet
  file:
    path: "{{ item }}"
    state: absent
  notify: reload systemd