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.

56 lines
2.6 KiB

  1. ---
  2. - name: Local Path Provisioner | Create addon dir
  3. file:
  4. path: "{{ kube_config_dir }}/addons/local_path_provisioner"
  5. state: directory
  6. owner: root
  7. group: root
  8. mode: 0755
  9. when:
  10. - inventory_hostname == groups['kube_control_plane'][0]
  11. - name: Local Path Provisioner | Create claim root dir
  12. file:
  13. path: "{{ local_path_provisioner_claim_root }}"
  14. state: directory
  15. - name: Local Path Provisioner | Render Template
  16. set_fact:
  17. local_path_provisioner_templates:
  18. - { name: local-path-storage-ns, file: local-path-storage-ns.yml, type: ns }
  19. - { name: local-path-storage-sa, file: local-path-storage-sa.yml, type: sa }
  20. - { name: local-path-storage-cr, file: local-path-storage-cr.yml, type: cr }
  21. - { name: local-path-storage-clusterrolebinding, file: local-path-storage-clusterrolebinding.yml, type: clusterrolebinding }
  22. - { name: local-path-storage-cm, file: local-path-storage-cm.yml, type: cm }
  23. - { name: local-path-storage-deployment, file: local-path-storage-deployment.yml, type: deployment }
  24. - { name: local-path-storage-sc, file: local-path-storage-sc.yml, type: sc }
  25. local_path_provisioner_templates_for_psp_not_system_ns:
  26. - { name: local-path-storage-psp, file: local-path-storage-psp.yml, type: psp }
  27. - { name: local-path-storage-psp-role, file: local-path-storage-psp-cr.yml, type: clusterrole }
  28. - { name: local-path-storage-psp-rb, file: local-path-storage-psp-rb.yml, type: rolebinding }
  29. - name: Local Path Provisioner | Insert extra templates to Local Path Provisioner templates list for PodSecurityPolicy
  30. set_fact:
  31. local_path_provisioner_templates: "{{ local_path_provisioner_templates[:3] + local_path_provisioner_templates_for_psp_not_system_ns + local_path_provisioner_templates[3:] }}"
  32. when:
  33. - podsecuritypolicy_enabled
  34. - local_path_provisioner_namespace != "kube-system"
  35. - name: Local Path Provisioner | Create manifests
  36. template:
  37. src: "{{ item.file }}.j2"
  38. dest: "{{ kube_config_dir }}/addons/local_path_provisioner/{{ item.file }}"
  39. with_items: "{{ local_path_provisioner_templates }}"
  40. register: local_path_provisioner_manifests
  41. when: inventory_hostname == groups['kube_control_plane'][0]
  42. - name: Local Path Provisioner | Apply manifests
  43. kube:
  44. name: "{{ item.item.name }}"
  45. namespace: "{{ local_path_provisioner_namespace }}"
  46. kubectl: "{{ bin_dir }}/kubectl"
  47. resource: "{{ item.item.type }}"
  48. filename: "{{ kube_config_dir }}/addons/local_path_provisioner/{{ item.item.file }}"
  49. state: "latest"
  50. with_items: "{{ local_path_provisioner_manifests.results }}"
  51. when: inventory_hostname == groups['kube_control_plane'][0]