2018-02-04 12:32:33 +08:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Registry | Create addon dir
|
|
|
|
file:
|
|
|
|
path: "{{ kube_config_dir }}/addons/registry"
|
2018-02-09 15:47:57 +08:00
|
|
|
state: directory
|
2018-02-04 12:32:33 +08:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
|
|
|
|
2018-08-23 00:16:13 +08:00
|
|
|
- name: Registry | Templates list
|
|
|
|
set_fact:
|
|
|
|
registry_templates:
|
|
|
|
- { name: registry-ns, file: registry-ns.yml, type: ns }
|
|
|
|
- { name: registry-sa, file: registry-sa.yml, type: sa }
|
|
|
|
- { name: registry-proxy-sa, file: registry-proxy-sa.yml, type: sa }
|
|
|
|
- { name: registry-svc, file: registry-svc.yml, type: svc }
|
|
|
|
- { name: registry-rs, file: registry-rs.yml, type: rs }
|
|
|
|
- { name: registry-proxy-ds, file: registry-proxy-ds.yml, type: ds }
|
|
|
|
registry_templates_for_psp:
|
|
|
|
- { name: registry-psp, file: registry-psp.yml, type: psp }
|
|
|
|
- { name: registry-cr, file: registry-cr.yml, type: clusterrole }
|
|
|
|
- { name: registry-crb, file: registry-crb.yml, type: rolebinding }
|
|
|
|
- { name: registry-proxy-psp, file: registry-proxy-psp.yml, type: psp }
|
|
|
|
- { name: registry-proxy-cr, file: registry-proxy-cr.yml, type: clusterrole }
|
|
|
|
- { name: registry-proxy-crb, file: registry-proxy-crb.yml, type: rolebinding }
|
|
|
|
|
|
|
|
- name: Registry | Append extra templates to Registry Templates list for PodSecurityPolicy
|
|
|
|
set_fact:
|
2018-08-29 17:35:00 +08:00
|
|
|
registry_templates: "{{ registry_templates[:3] + registry_templates_for_psp + registry_templates[3:] }}"
|
2018-08-23 00:16:13 +08:00
|
|
|
when:
|
|
|
|
- podsecuritypolicy_enabled
|
|
|
|
- registry_namespace != "kube-system"
|
|
|
|
|
2018-02-04 12:32:33 +08:00
|
|
|
- name: Registry | Create manifests
|
|
|
|
template:
|
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/registry/{{ item.file }}"
|
2018-08-23 00:16:13 +08:00
|
|
|
with_items: "{{ registry_templates }}"
|
2018-02-04 12:32:33 +08:00
|
|
|
register: registry_manifests
|
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
|
|
|
|
|
|
|
- name: Registry | Apply manifests
|
|
|
|
kube:
|
2019-04-24 01:37:23 +08:00
|
|
|
name: "{{ item.item.name }}"
|
2018-02-09 15:47:57 +08:00
|
|
|
namespace: "{{ registry_namespace }}"
|
2018-02-04 12:32:33 +08:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2019-04-24 01:37:23 +08:00
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/addons/registry/{{ item.item.file }}"
|
2018-02-04 12:32:33 +08:00
|
|
|
state: "latest"
|
2019-04-24 01:37:23 +08:00
|
|
|
with_items: "{{ registry_manifests.results }}"
|
2018-02-04 12:32:33 +08:00
|
|
|
when: inventory_hostname == groups['kube-master'][0]
|
2018-02-09 15:47:57 +08:00
|
|
|
|
|
|
|
- name: Registry | Create PVC manifests
|
|
|
|
template:
|
|
|
|
src: "{{ item.file }}.j2"
|
|
|
|
dest: "{{ kube_config_dir }}/addons/registry/{{ item.file }}"
|
|
|
|
with_items:
|
|
|
|
- { name: registry-pvc, file: registry-pvc.yml, type: pvc }
|
|
|
|
register: registry_manifests
|
|
|
|
when:
|
2018-12-29 14:31:47 +08:00
|
|
|
- registry_storage_class != none and registry_storage_class != ""
|
|
|
|
- registry_disk_size != none and registry_disk_size != ""
|
2018-02-09 15:47:57 +08:00
|
|
|
- inventory_hostname == groups['kube-master'][0]
|
|
|
|
|
|
|
|
- name: Registry | Apply PVC manifests
|
|
|
|
kube:
|
2019-04-24 01:37:23 +08:00
|
|
|
name: "{{ item.item.name }}"
|
2018-02-09 15:47:57 +08:00
|
|
|
namespace: "{{ registry_namespace }}"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
2019-04-24 01:37:23 +08:00
|
|
|
resource: "{{ item.item.type }}"
|
|
|
|
filename: "{{ kube_config_dir }}/addons/registry/{{ item.item.file }}"
|
2018-02-09 15:47:57 +08:00
|
|
|
state: "latest"
|
2019-04-24 01:37:23 +08:00
|
|
|
with_items: "{{ registry_manifests.results }}"
|
2018-02-09 15:47:57 +08:00
|
|
|
when:
|
2018-12-29 14:31:47 +08:00
|
|
|
- registry_storage_class != none and registry_storage_class != ""
|
|
|
|
- registry_disk_size != none and registry_disk_size != ""
|
2018-02-09 15:47:57 +08:00
|
|
|
- inventory_hostname == groups['kube-master'][0]
|