summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/prune/tasks/main.yml
blob: 88ab7ecd35ba6047c53019068231e2475578f915 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
- name: drain and remove superflous nodes
  run_once: true
  delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}"
  block:
  - name: drain superflous nodes
    loop: "{{ groups['_kubernetes_nodes_prune_'] | default([]) }}"
    command: "kubectl --kubeconfig /etc/kubernetes/admin.conf drain {{ hostvars[item].kubernetes_node_name }} --delete-local-data --force --ignore-daemonsets"

  - name: remove nodes from api server
    loop: "{{ groups['_kubernetes_nodes_prune_'] | default([]) }}"
    command: "kubectl --kubeconfig /etc/kubernetes/admin.conf delete node {{ hostvars[item].kubernetes_node_name }}"

- name: prune network plugin
  include_tasks: "net_{{ kubernetes_network_plugin }}.yml"