You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.9 KiB

  1. ---
  2. - name: Registry | Create addon dir
  3. file:
  4. path: "{{ kube_config_dir }}/addons/registry"
  5. state: directory
  6. owner: root
  7. group: root
  8. mode: 0755
  9. - name: Registry | Templates list
  10. set_fact:
  11. registry_templates:
  12. - { name: registry-ns, file: registry-ns.yml, type: ns }
  13. - { name: registry-sa, file: registry-sa.yml, type: sa }
  14. - { name: registry-proxy-sa, file: registry-proxy-sa.yml, type: sa }
  15. - { name: registry-svc, file: registry-svc.yml, type: svc }
  16. - { name: registry-rs, file: registry-rs.yml, type: rs }
  17. - { name: registry-proxy-ds, file: registry-proxy-ds.yml, type: ds }
  18. registry_templates_for_psp:
  19. - { name: registry-psp, file: registry-psp.yml, type: psp }
  20. - { name: registry-cr, file: registry-cr.yml, type: clusterrole }
  21. - { name: registry-crb, file: registry-crb.yml, type: rolebinding }
  22. - { name: registry-proxy-psp, file: registry-proxy-psp.yml, type: psp }
  23. - { name: registry-proxy-cr, file: registry-proxy-cr.yml, type: clusterrole }
  24. - { name: registry-proxy-crb, file: registry-proxy-crb.yml, type: rolebinding }
  25. - name: Registry | Append extra templates to Registry Templates list for PodSecurityPolicy
  26. set_fact:
  27. registry_templates: "{{ registry_templates[:3] + registry_templates_for_psp + registry_templates[3:] }}"
  28. when:
  29. - podsecuritypolicy_enabled
  30. - registry_namespace != "kube-system"
  31. - name: Registry | Create manifests
  32. template:
  33. src: "{{ item.file }}.j2"
  34. dest: "{{ kube_config_dir }}/addons/registry/{{ item.file }}"
  35. with_items: "{{ registry_templates }}"
  36. register: registry_manifests
  37. when: inventory_hostname == groups['kube-master'][0]
  38. - name: Registry | Apply manifests
  39. kube:
  40. name: "{{ item.item.name }}"
  41. namespace: "{{ registry_namespace }}"
  42. kubectl: "{{ bin_dir }}/kubectl"
  43. resource: "{{ item.item.type }}"
  44. filename: "{{ kube_config_dir }}/addons/registry/{{ item.item.file }}"
  45. state: "latest"
  46. with_items: "{{ registry_manifests.results }}"
  47. when: inventory_hostname == groups['kube-master'][0]
  48. - name: Registry | Create PVC manifests
  49. template:
  50. src: "{{ item.file }}.j2"
  51. dest: "{{ kube_config_dir }}/addons/registry/{{ item.file }}"
  52. with_items:
  53. - { name: registry-pvc, file: registry-pvc.yml, type: pvc }
  54. register: registry_manifests
  55. when:
  56. - registry_storage_class != none
  57. - registry_disk_size != none
  58. - inventory_hostname == groups['kube-master'][0]
  59. - name: Registry | Apply PVC manifests
  60. kube:
  61. name: "{{ item.item.name }}"
  62. namespace: "{{ registry_namespace }}"
  63. kubectl: "{{ bin_dir }}/kubectl"
  64. resource: "{{ item.item.type }}"
  65. filename: "{{ kube_config_dir }}/addons/registry/{{ item.item.file }}"
  66. state: "latest"
  67. with_items: "{{ registry_manifests.results }}"
  68. when:
  69. - registry_storage_class != none
  70. - registry_disk_size != none
  71. - inventory_hostname == groups['kube-master'][0]