2018-03-28 22:30:00 +08:00
|
|
|
---
|
|
|
|
|
2018-06-26 14:42:05 +08:00
|
|
|
- name: Cert Manager | Remove legacy addon dir and manifests
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/cert_manager"
|
|
|
|
state: absent
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube-master'][0]
|
|
|
|
tags:
|
|
|
|
- upgrade
|
|
|
|
|
|
|
|
- name: Cert Manager | Remove legacy namespace
|
|
|
|
shell: |
|
|
|
|
{{ bin_dir }}/kubectl delete namespace {{ cert_manager_namespace }}
|
|
|
|
ignore_errors: yes
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube-master'][0]
|
|
|
|
tags:
|
|
|
|
- upgrade
|
|
|
|
|
2018-03-28 22:30:00 +08: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 14:42:05 +08:00
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube-master'][0]
|
2018-03-28 22:30:00 +08:00
|
|
|
|
|
|
|
- name: Cert Manager | Create manifests
|
|
|
|
template:
|
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/cert_manager/{{ item.file }}"
|
|
|
|
with_items:
|
2018-06-26 14:42:05 +08:00
|
|
|
- { 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-clusterissuer, file: crd-clusterissuer.yml, type: crd }
|
|
|
|
- { name: crd-issuer, file: crd-issuer.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: deploy-cert-manager, file: deploy-cert-manager.yml, type: deploy }
|
2018-03-28 22:30:00 +08:00
|
|
|
register: cert_manager_manifests
|
|
|
|
when:
|
|
|
|
- inventory_hostname == groups['kube-master'][0]
|
|
|
|
|
|
|
|
- name: Cert Manager | Apply manifests
|
|
|
|
kube:
|
|
|
|
namespace: "{{ cert_manager_namespace }}"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2019-04-23 14:34:10 +08:00
|
|
|
filename: "{{ cert_manager_manifests.results | selectattr('skipped', 'undefined') | map(attribute='item') | map(attribute='file') | map('regex_replace', '^(.*)$', kube_config_dir+'/addons/cert_manager/\\1') | list }}"
|
2018-03-28 22:30:00 +08:00
|
|
|
state: "latest"
|
2019-04-23 14:34:10 +08:00
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|