glusterfs_registry.yml 4.5 KB

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