summaryrefslogtreecommitdiff
path: root/roles/kubernetes/addons/node-feature-discovery/tasks/main.yml
blob: 80acb7b9fc47773547dbd6c16a9f8ecb8cc0649b (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
- name: create base directory for node-feature-discovery addon
  run_once: true
  delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}"
  file:
    path: /etc/kubernetes/addons/node-feature-discovery
    state: directory

- name: install python-cryptoraphy
  apt:
    name: "{{ python_basename }}-cryptography"
    state: present

- name: generate certificate authority and master certificate
  run_once: true
  delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}"
  import_tasks: tls-ca-master.yml

- name: generate certificate
  import_tasks: tls-worker.yml

- name: deploy node-feature-discovery addon
  run_once: true
  delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}"
  block:
  - name: copy config for node-feature-discovery
    template:
      src: "config.{{ kubernetes_node_feature_discovery_version }}.yml.j2"
      dest: /etc/kubernetes/addons/node-feature-discovery/config.yml

  - name: generate kustomization file
    template:
      src: "kustomization.yml.j2"
      dest: /etc/kubernetes/addons/node-feature-discovery/kustomization.yml

  - name: check if node-feature-discovery is already installed
    check_mode: no
    command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -k /etc/kubernetes/addons/node-feature-discovery/
    failed_when: false
    changed_when: false
    register: kube_node_feature_discovery_diff_result

  - name: install node-feature-discovery onto the cluster
    when: kube_node_feature_discovery_diff_result.rc != 0
    command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -k /etc/kubernetes/addons/node-feature-discovery/