glusterfs_registry.yml 4.3 KB

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