summaryrefslogtreecommitdiff
path: root/roles/kubernetes/addons/metrics-server/tasks/main.yml
blob: 87c573467ba2c548c111725102849600597f3c52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
- name: create base directory for metrics-server addon
  file:
    path: /etc/kubernetes/addons/metrics-server
    state: directory

- name: copy config for metrics-server
  template:
    src: "components.{{ kubernetes_metrics_server_version }}.yml.j2"
    dest: /etc/kubernetes/addons/metrics-server/config.yml

- name: check if metrics-server is already installed
  check_mode: no
  command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/addons/metrics-server/config.yml
  failed_when: false
  changed_when: false
  register: kube_metrics_server_diff_result

- name: install metrics-server onto the cluster
  when: kube_metrics_server_diff_result.rc != 0
  command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/addons/metrics-server/config.yml