glusterfs_registry.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_max_host_vol: "{{ openshift_storage_glusterfs_registry_block_max_host_vol }}"
  16. glusterfs_wipe: "{{ openshift_storage_glusterfs_registry_wipe | bool }}"
  17. glusterfs_heketi_is_native: "{{ openshift_storage_glusterfs_registry_heketi_is_native | bool }}"
  18. glusterfs_heketi_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_is_missing | bool }}"
  19. glusterfs_heketi_deploy_is_missing: "{{ openshift_storage_glusterfs_registry_heketi_deploy_is_missing | bool }}"
  20. glusterfs_heketi_cli: "{{ openshift_storage_glusterfs_registry_heketi_cli }}"
  21. glusterfs_heketi_image: "{{ openshift_storage_glusterfs_registry_heketi_image }}"
  22. glusterfs_heketi_version: "{{ openshift_storage_glusterfs_registry_heketi_version }}"
  23. glusterfs_heketi_admin_key: "{{ openshift_storage_glusterfs_registry_heketi_admin_key }}"
  24. glusterfs_heketi_user_key: "{{ openshift_storage_glusterfs_registry_heketi_user_key }}"
  25. glusterfs_heketi_topology_load: "{{ openshift_storage_glusterfs_registry_heketi_topology_load | bool }}"
  26. glusterfs_heketi_wipe: "{{ openshift_storage_glusterfs_registry_heketi_wipe | bool }}"
  27. glusterfs_heketi_url: "{{ openshift_storage_glusterfs_registry_heketi_url }}"
  28. glusterfs_heketi_port: "{{ openshift_storage_glusterfs_registry_heketi_port }}"
  29. glusterfs_heketi_executor: "{{ openshift_storage_glusterfs_registry_heketi_executor }}"
  30. glusterfs_heketi_ssh_port: "{{ openshift_storage_glusterfs_registry_heketi_ssh_port }}"
  31. glusterfs_heketi_ssh_user: "{{ openshift_storage_glusterfs_registry_heketi_ssh_user }}"
  32. glusterfs_heketi_ssh_sudo: "{{ openshift_storage_glusterfs_registry_heketi_ssh_sudo | bool }}"
  33. glusterfs_heketi_ssh_keyfile: "{{ openshift_storage_glusterfs_registry_heketi_ssh_keyfile }}"
  34. glusterfs_heketi_fstab: "{{ openshift_storage_glusterfs_registry_heketi_fstab }}"
  35. glusterfs_nodes: "{{ groups.glusterfs_registry | default(groups.glusterfs) }}"
  36. - include: glusterfs_common.yml
  37. when:
  38. - glusterfs_nodes | default([]) | count > 0
  39. - "'glusterfs' not in groups or glusterfs_nodes != groups.glusterfs"
  40. - name: Delete pre-existing GlusterFS registry resources
  41. oc_obj:
  42. namespace: "{{ glusterfs_namespace }}"
  43. kind: "{{ item.kind }}"
  44. name: "{{ item.name }}"
  45. state: absent
  46. with_items:
  47. - kind: "svc"
  48. name: "glusterfs-{{ glusterfs_name | default }}-endpoints"
  49. failed_when: False
  50. - name: Generate GlusterFS registry endpoints
  51. template:
  52. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-endpoints.yml.j2"
  53. dest: "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  54. - name: Copy GlusterFS registry service
  55. template:
  56. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-service.yml.j2"
  57. dest: "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  58. - name: Create GlusterFS registry endpoints
  59. oc_obj:
  60. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  61. state: present
  62. kind: endpoints
  63. name: "glusterfs-{{ glusterfs_name }}-endpoints"
  64. files:
  65. - "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  66. - name: Create GlusterFS registry service
  67. oc_obj:
  68. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  69. state: present
  70. kind: service
  71. name: "glusterfs-{{ glusterfs_name }}-endpoints"
  72. files:
  73. - "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  74. - name: Check if GlusterFS registry volume exists
  75. command: "{{ glusterfs_heketi_client }} volume list"
  76. register: registry_volume
  77. - name: Create GlusterFS registry volume
  78. command: "{{ glusterfs_heketi_client }} volume create --size={{ openshift.hosted.registry.storage.volume.size | replace('Gi','') }} --name={{ openshift.hosted.registry.storage.glusterfs.path }}"
  79. when: "openshift.hosted.registry.storage.glusterfs.path not in registry_volume.stdout"