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.

79 lines
2.9 KiB

  1. ---
  2. - name: RBD Provisioner | Remove legacy addon dir and manifests
  3. file:
  4. path: "{{ kube_config_dir }}/addons/rbd_provisioner"
  5. state: absent
  6. when:
  7. - inventory_hostname == groups['kube-master'][0]
  8. tags:
  9. - upgrade
  10. - name: RBD Provisioner | Remove legacy namespace
  11. shell: |
  12. {{ bin_dir }}/kubectl delete namespace {{ rbd_provisioner_namespace }}
  13. ignore_errors: yes
  14. when:
  15. - inventory_hostname == groups['kube-master'][0]
  16. tags:
  17. - upgrade
  18. - name: RBD Provisioner | Remove legacy storageclass
  19. shell: |
  20. {{ bin_dir }}/kubectl delete storageclass {{ rbd_provisioner_storage_class }}
  21. ignore_errors: yes
  22. when:
  23. - inventory_hostname == groups['kube-master'][0]
  24. tags:
  25. - upgrade
  26. - name: RBD Provisioner | Create addon dir
  27. file:
  28. path: "{{ kube_config_dir }}/addons/rbd_provisioner"
  29. state: directory
  30. owner: root
  31. group: root
  32. mode: 0755
  33. when:
  34. - inventory_hostname == groups['kube-master'][0]
  35. - name: RBD Provisioner | Templates list
  36. set_fact:
  37. rbd_provisioner_templates:
  38. - { name: 00-namespace, file: 00-namespace.yml, type: ns }
  39. - { name: secret-rbd-provisioner, file: secret-rbd-provisioner.yml, type: secret }
  40. - { name: sa-rbd-provisioner, file: sa-rbd-provisioner.yml, type: sa }
  41. - { name: clusterrole-rbd-provisioner, file: clusterrole-rbd-provisioner.yml, type: clusterrole }
  42. - { name: clusterrolebinding-rbd-provisioner, file: clusterrolebinding-rbd-provisioner.yml, type: clusterrolebinding }
  43. - { name: role-rbd-provisioner, file: role-rbd-provisioner.yml, type: role }
  44. - { name: rolebinding-rbd-provisioner, file: rolebinding-rbd-provisioner.yml, type: rolebinding }
  45. - { name: deploy-rbd-provisioner, file: deploy-rbd-provisioner.yml, type: deploy }
  46. - { name: sc-rbd-provisioner, file: sc-rbd-provisioner.yml, type: sc }
  47. rbd_provisioner_templates_for_psp:
  48. - { name: psp-rbd-provisioner, file: psp-rbd-provisioner.yml, type: psp }
  49. - name: RBD Provisioner | Append extra templates to RBD Provisioner Templates list for PodSecurityPolicy
  50. set_fact:
  51. rbd_provisioner_templates: "{{ rbd_provisioner_templates_for_psp + rbd_provisioner_templates }}"
  52. when:
  53. - podsecuritypolicy_enabled
  54. - rbd_provisioner_namespace != "kube-system"
  55. - name: RBD Provisioner | Create manifests
  56. template:
  57. src: "{{ item.file }}.j2"
  58. dest: "{{ kube_config_dir }}/addons/rbd_provisioner/{{ item.file }}"
  59. with_items: "{{ rbd_provisioner_templates }}"
  60. register: rbd_provisioner_manifests
  61. when: inventory_hostname == groups['kube-master'][0]
  62. - name: RBD Provisioner | Apply manifests
  63. kube:
  64. name: "{{ item.item.name }}"
  65. namespace: "{{ rbd_provisioner_namespace }}"
  66. kubectl: "{{ bin_dir }}/kubectl"
  67. resource: "{{ item.item.type }}"
  68. filename: "{{ kube_config_dir }}/addons/rbd_provisioner/{{ item.item.file }}"
  69. state: "latest"
  70. with_items: "{{ rbd_provisioner_manifests.results }}"
  71. when: inventory_hostname == groups['kube-master'][0]