glusterfs_common.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ---
  2. - name: Make sure heketi-client is installed
  3. package: name=heketi-client state=present
  4. when:
  5. - not openshift_is_atomic | bool
  6. - not glusterfs_heketi_is_native | bool
  7. register: result
  8. until: result is succeeded
  9. - name: Verify heketi-cli is installed
  10. shell: "command -v {{ glusterfs_heketi_cli }} >/dev/null 2>&1 || { echo >&2 'ERROR: Make sure heketi-cli is available, then re-run the installer'; exit 1; }"
  11. changed_when: False
  12. when:
  13. - not glusterfs_heketi_is_native | bool
  14. - name: Verify target namespace exists
  15. oc_project:
  16. state: present
  17. name: "{{ glusterfs_namespace }}"
  18. node_selector: "{% if glusterfs_use_default_selector %}{{ omit }}{% endif %}"
  19. when: glusterfs_is_native or glusterfs_heketi_is_native or glusterfs_storageclass
  20. - name: Add namespace service accounts to privileged SCC
  21. oc_adm_policy_user:
  22. user: "system:serviceaccount:{{ glusterfs_namespace }}:{{ item }}"
  23. resource_kind: scc
  24. resource_name: privileged
  25. state: present
  26. with_items:
  27. - 'default'
  28. - 'router'
  29. when: glusterfs_is_native or glusterfs_heketi_is_native
  30. - import_tasks: glusterfs_deploy.yml
  31. when: glusterfs_is_native
  32. - import_tasks: heketi_setup.yml
  33. when: glusterfs_heketi_is_native
  34. - import_tasks: heketi_deploy_part1.yml
  35. when:
  36. - glusterfs_heketi_is_native
  37. - glusterfs_heketi_deploy_is_missing
  38. - glusterfs_heketi_is_missing
  39. - import_tasks: heketi_load.yml
  40. - import_tasks: heketi_deploy_part2.yml
  41. when:
  42. - glusterfs_heketi_is_native
  43. - glusterfs_heketi_is_missing
  44. - name: Check if gluster-s3 can't be deployed
  45. set_fact:
  46. glusterfs_s3_deploy: False
  47. when:
  48. - "glusterfs_s3_account is not defined or glusterfs_s3_user is not defined or glusterfs_s3_password is not defined"
  49. - block:
  50. - name: Create heketi secret
  51. oc_secret:
  52. namespace: "{{ glusterfs_namespace }}"
  53. state: present
  54. name: "heketi-{{ glusterfs_name }}-admin-secret"
  55. type: "kubernetes.io/glusterfs"
  56. force: True
  57. contents:
  58. - path: key
  59. data: "{{ glusterfs_heketi_admin_key }}"
  60. when:
  61. - glusterfs_heketi_admin_key is defined
  62. - name: Generate GlusterFS StorageClass file
  63. template:
  64. src: "glusterfs-storageclass.yml.j2"
  65. dest: "{{ mktemp.stdout }}/glusterfs-storageclass.yml"
  66. - name: Create GlusterFS StorageClass
  67. oc_obj:
  68. state: present
  69. kind: storageclass
  70. name: "glusterfs-{{ glusterfs_name }}"
  71. files:
  72. - "{{ mktemp.stdout }}/glusterfs-storageclass.yml"
  73. when:
  74. - glusterfs_storageclass or glusterfs_s3_deploy
  75. - import_tasks: glusterblock_deploy.yml
  76. when: glusterfs_block_deploy
  77. - import_tasks: glusterblock_storageclass.yml
  78. when: glusterfs_block_storageclass
  79. - import_tasks: gluster_s3_deploy.yml
  80. when: glusterfs_s3_deploy