2018-03-28 14:30:00 +00:00
|
|
|
---
|
|
|
|
|
2018-06-26 06:42:05 +00:00
|
|
|
- name: Cert Manager | Remove legacy addon dir and manifests
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/cert_manager"
|
|
|
|
state: absent
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-06-26 06:42:05 +00:00
|
|
|
tags:
|
|
|
|
- upgrade
|
|
|
|
|
|
|
|
- name: Cert Manager | Remove legacy namespace
|
|
|
|
shell: |
|
|
|
|
{{ bin_dir }}/kubectl delete namespace {{ cert_manager_namespace }}
|
2021-07-12 07:00:47 +00:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2018-06-26 06:42:05 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-06-26 06:42:05 +00:00
|
|
|
tags:
|
|
|
|
- upgrade
|
|
|
|
|
2018-03-28 14:30:00 +00:00
|
|
|
- name: Cert Manager | Create addon dir
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/cert_manager"
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
2018-06-26 06:42:05 +00:00
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-03-28 14:30:00 +00:00
|
|
|
|
2020-08-06 06:26:55 +00:00
|
|
|
- name: Cert Manager | Templates list
|
|
|
|
set_fact:
|
|
|
|
cert_manager_templates:
|
|
|
|
- { name: 00-namespace, file: 00-namespace.yml, type: ns }
|
|
|
|
- { name: sa-cert-manager, file: sa-cert-manager.yml, type: sa }
|
|
|
|
- { name: crd-certificate, file: crd-certificate.yml, type: crd }
|
|
|
|
- { name: crd-challenge, file: crd-challenge.yml, type: crd }
|
|
|
|
- { name: crd-clusterissuer, file: crd-clusterissuer.yml, type: crd }
|
|
|
|
- { name: crd-issuer, file: crd-issuer.yml, type: crd }
|
|
|
|
- { name: crd-order, file: crd-order.yml, type: crd }
|
|
|
|
- { name: clusterrole-cert-manager, file: clusterrole-cert-manager.yml, type: clusterrole }
|
|
|
|
- { name: clusterrolebinding-cert-manager, file: clusterrolebinding-cert-manager.yml, type: clusterrolebinding }
|
|
|
|
- { name: role-cert-manager, file: role-cert-manager.yml, type: role }
|
|
|
|
- { name: rolebinding-cert-manager, file: rolebinding-cert-manager.yml, type: rolebinding }
|
|
|
|
- { name: deploy-cert-manager, file: deploy-cert-manager.yml, type: deploy }
|
|
|
|
- { name: svc-cert-manager, file: svc-cert-manager.yml, type: svc }
|
|
|
|
- { name: webhook-cert-manager, file: webhook-cert-manager.yml, type: webhook }
|
|
|
|
- { name: secret-cert-manager, file: secret-cert-manager.yml, type: secret }
|
|
|
|
|
2018-03-28 14:30:00 +00:00
|
|
|
- name: Cert Manager | Create manifests
|
|
|
|
template:
|
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/cert_manager/{{ item.file }}"
|
2020-08-06 06:26:55 +00:00
|
|
|
with_items: "{{ cert_manager_templates }}"
|
2018-03-28 14:30:00 +00:00
|
|
|
register: cert_manager_manifests
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2018-03-28 14:30:00 +00:00
|
|
|
|
|
|
|
- name: Cert Manager | Apply manifests
|
|
|
|
kube:
|
2019-04-23 17:37:23 +00:00
|
|
|
name: "{{ item.item.name }}"
|
2018-03-28 14:30:00 +00:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2019-04-23 17:37:23 +00:00
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/addons/cert_manager/{{ item.item.file }}"
|
2018-03-28 14:30:00 +00:00
|
|
|
state: "latest"
|
2019-04-23 17:37:23 +00:00
|
|
|
with_items: "{{ cert_manager_manifests.results }}"
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2020-08-06 06:26:55 +00:00
|
|
|
|
|
|
|
- name: Cert Manager | Wait for Webhook pods become ready
|
2020-08-20 11:25:45 +00:00
|
|
|
command: "{{ bin_dir }}/kubectl wait po --namespace={{ cert_manager_namespace }} --selector app=webhook --for=condition=Ready --timeout=600s"
|
2020-08-06 06:26:55 +00:00
|
|
|
register: cert_manager_webhook_pods_ready
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0]
|
2020-08-06 06:26:55 +00:00
|
|
|
|
|
|
|
- name: Cert Manager | Create ClusterIssuer manifest
|
|
|
|
template:
|
|
|
|
src: "clusterissuer-cert-manager.yml.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/cert_manager/clusterissuer-cert-manager.yml"
|
|
|
|
register: cert_manager_clusterissuer_manifest
|
|
|
|
when:
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0] and cert_manager_webhook_pods_ready is succeeded
|
2020-08-06 06:26:55 +00:00
|
|
|
|
|
|
|
- name: Cert Manager | Apply ClusterIssuer manifest
|
|
|
|
kube:
|
|
|
|
name: "clusterissuer-cert-manager"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
filename: "{{ kube_config_dir }}/addons/cert_manager/clusterissuer-cert-manager.yml"
|
|
|
|
state: "latest"
|
2021-03-24 00:26:05 +00:00
|
|
|
when: inventory_hostname == groups['kube_control_plane'][0] and cert_manager_clusterissuer_manifest is succeeded
|