glusterfs_registry.yml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. ---
  2. - set_fact:
  3. glusterfs_timeout: "{{ openshift_storage_glusterfs_registry_timeout }}"
  4. glusterfs_namespace: "{{ openshift_storage_glusterfs_registry_namespace }}"
  5. glusterfs_is_native: "{{ openshift_storage_glusterfs_registry_is_native | bool }}"
  6. glusterfs_name: "{{ openshift_storage_glusterfs_registry_name }}"
  7. glusterfs_nodeselector: "{{ openshift_storage_glusterfs_registry_nodeselector | default(['storagenode', openshift_storage_glusterfs_registry_name] | join('=')) | map_from_pairs }}"
  8. glusterfs_use_default_selector: "{{ openshift_storage_glusterfs_registry_use_default_selector }}"
  9. glusterfs_storageclass: "{{ openshift_storage_glusterfs_registry_storageclass }}"
  10. glusterfs_image: "{{ openshift_storage_glusterfs_registry_image }}"
  11. glusterfs_version: "{{ openshift_storage_glusterfs_registry_version }}"
  12. glusterfs_block_deploy: "{{ openshift_storage_glusterfs_registry_block_deploy | bool }}"
  13. glusterfs_block_image: "{{ openshift_storage_glusterfs_registry_block_image }}"
  14. glusterfs_block_version: "{{ openshift_storage_glusterfs_registry_block_version }}"
  15. glusterfs_block_host_vol_create: "{{ openshift_storage_glusterfs_registry_block_host_vol_create }}"
  16. glusterfs_block_host_vol_size: "{{ openshift_storage_glusterfs_registry_block_host_vol_size }}"
  17. glusterfs_block_host_vol_max: "{{ openshift_storage_glusterfs_registry_block_host_vol_max }}"
  18. glusterfs_s3_deploy: "{{ openshift_storage_glusterfs_registry_s3_deploy | bool }}"
  19. glusterfs_s3_image: "{{ openshift_storage_glusterfs_registry_s3_image }}"
  20. glusterfs_s3_version: "{{ openshift_storage_glusterfs_registry_s3_version }}"
  21. glusterfs_s3_account: "{{ openshift_storage_glusterfs_registry_s3_account }}"
  22. glusterfs_s3_user: "{{ openshift_storage_glusterfs_registry_s3_user }}"
  23. glusterfs_s3_password: "{{ openshift_storage_glusterfs_registry_s3_password }}"
  24. glusterfs_s3_pvc: "{{ openshift_storage_glusterfs_registry_s3_pvc }}"
  25. glusterfs_s3_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_pvc_size }}"
  26. glusterfs_s3_meta_pvc: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc }}"
  27. glusterfs_s3_meta_pvc_size: "{{ openshift_storage_glusterfs_registry_s3_meta_pvc_size }}"
  28. glusterfs_wipe: "{{ openshift_storage_glusterfs_registry_wipe | bool }}"
  29. glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_registry_heketi_is_native | bool }}"
  30. glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_is_missing | bool }}"
  31. glusterfs_heketi_deploy_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_deploy_is_missing | bool }}"
  32. glusterfs_heketi_cli: "{{ openshift_storage_glusterfs_registry_heketi_cli }}"
  33. glusterfs_heketi_image: "{{ openshift_storage_glusterfs_registry_heketi_image }}"
  34. glusterfs_heketi_version: "{{ openshift_storage_glusterfs_registry_heketi_version }}"
  35. glusterfs_heketi_admin_key: "{{ openshift_storage_glusterfs_registry_heketi_admin_key }}"
  36. glusterfs_heketi_user_key: "{{ openshift_storage_glusterfs_registry_heketi_user_key }}"
  37. glusterfs_heketi_topology_load: "{{ openshift_storage_glusterfs_registry_heketi_topology_load | bool }}"
  38. glusterfs_heketi_wipe: "{{ openshift_storage_glusterfs_registry_heketi_wipe | bool }}"
  39. glusterfs_heketi_url: "{{ openshift_storage_glusterfs_registry_heketi_url }}"
  40. glusterfs_heketi_port: "{{ openshift_storage_glusterfs_registry_heketi_port }}"
  41. glusterfs_heketi_executor: "{{ openshift_storage_glusterfs_registry_heketi_executor }}"
  42. glusterfs_heketi_ssh_port: "{{ openshift_storage_glusterfs_registry_heketi_ssh_port }}"
  43. glusterfs_heketi_ssh_user: "{{ openshift_storage_glusterfs_registry_heketi_ssh_user }}"
  44. glusterfs_heketi_ssh_sudo: "{{ openshift_storage_glusterfs_registry_heketi_ssh_sudo | bool }}"
  45. glusterfs_heketi_ssh_keyfile: "{{ openshift_storage_glusterfs_registry_heketi_ssh_keyfile }}"
  46. glusterfs_heketi_fstab: "{{ openshift_storage_glusterfs_registry_heketi_fstab }}"
  47. glusterfs_nodes: "{{ groups.glusterfs_registry | default(groups.glusterfs) }}"
  48. - include: glusterfs_common.yml
  49. when:
  50. - glusterfs_nodes | default([]) | count > 0
  51. - "'glusterfs' not in groups or glusterfs_nodes != groups.glusterfs"
  52. - name: Delete pre-existing GlusterFS registry resources
  53. oc_obj:
  54. namespace: "{{ glusterfs_namespace }}"
  55. kind: "{{ item.kind }}"
  56. name: "{{ item.name }}"
  57. state: absent
  58. with_items:
  59. - kind: "svc"
  60. name: "glusterfs-{{ glusterfs_name | default }}-endpoints"
  61. failed_when: False
  62. - name: Generate GlusterFS registry endpoints
  63. template:
  64. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-endpoints.yml.j2"
  65. dest: "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  66. - name: Copy GlusterFS registry service
  67. template:
  68. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-service.yml.j2"
  69. dest: "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  70. - name: Create GlusterFS registry endpoints
  71. oc_obj:
  72. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  73. state: present
  74. kind: endpoints
  75. name: "glusterfs-{{ glusterfs_name }}-endpoints"
  76. files:
  77. - "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  78. - name: Create GlusterFS registry service
  79. oc_obj:
  80. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  81. state: present
  82. kind: service
  83. name: "glusterfs-{{ glusterfs_name }}-endpoints"
  84. files:
  85. - "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  86. - name: Check if GlusterFS registry volume exists
  87. command: "{{ glusterfs_heketi_client }} volume list"
  88. register: registry_volume
  89. - name: Create GlusterFS registry volume
  90. command: "{{ glusterfs_heketi_client }} volume create --size={{ openshift.hosted.registry.storage.volume.size | replace('Gi','') }} --name={{ openshift.hosted.registry.storage.glusterfs.path }}"
  91. when: "openshift.hosted.registry.storage.glusterfs.path not in registry_volume.stdout"