summaryrefslogtreecommitdiff
path: root/roles/kubernetes/addons/node-feature-discovery/tasks/main.yml
blob: 93b53bb18e37b945af8ece6c87aa7b4c1b7d6406 (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
46
47
48
---
- 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 base resources for node-feature-discovery
    template:
      src: "base.{{ kubernetes_node_feature_discovery_version }}.yml.j2"
      dest: /etc/kubernetes/addons/node-feature-discovery/base.yml

  - name: generate kustomization and nfd-worker config files
    loop:
    - kustomization.yml
    - nfd-worker.conf
    template:
      src: "{{ item }}.j2"
      dest: /etc/kubernetes/addons/node-feature-discovery/{{ item }}

  - 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/