summaryrefslogtreecommitdiff
path: root/roles/kubernetes/addons/cert-manager/tasks/main.yml
blob: e34085e17f30c4c25d4877a49448ccc281c2fce8 (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
---
- name: deploy metrics-server addon
  run_once: true
  delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}"
  block:
  - name: create base directory for cert-manager addon
    file:
      path: /etc/kubernetes/addons/cert-manager
      state: directory

  - name: copy config for cert-manager
    template:
      src: "config.{{ kubernetes_cert_manager_version }}.yml.j2"
      dest: /etc/kubernetes/addons/cert-manager/config.yml

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

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