summaryrefslogtreecommitdiff
path: root/roles/kubernetes/kubeadm/control-plane/tasks/net_kubeguard.yml
blob: 05428ea1bf6ab5d13437715d4f0c62f5d35148c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
- name: install node-local dns cache
  when: kubernetes_enable_nodelocal_dnscache
  block:
  - name: generate node-local dns cache config
    template:
      src: net_kubeguard/node-local-dns.yml.j2
      dest: /etc/kubernetes/network-plugin/node-local-dns.yml

  - name: check if node-local dns cache is already installed
    check_mode: no
    command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/network-plugin/node-local-dns.yml
    failed_when: false
    changed_when: false
    register: kube_node_local_dns_diff_result

  - name: install node-local dns cache
    when: kube_node_local_dns_diff_result.rc != 0
    command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/network-plugin/node-local-dns.yml