glusterfs_registry.yml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_nodes: "{{ groups.glusterfs_registry | default(groups.glusterfs) }}"
  31. - include: glusterfs_common.yml
  32. when:
  33. - glusterfs_nodes | default([]) | count > 0
  34. - "'glusterfs' not in groups or glusterfs_nodes != groups.glusterfs"
  35. - name: Delete pre-existing GlusterFS registry resources
  36. oc_obj:
  37. namespace: "{{ glusterfs_namespace }}"
  38. kind: "{{ item.kind }}"
  39. name: "{{ item.name }}"
  40. state: absent
  41. with_items:
  42. - kind: "svc"
  43. name: "glusterfs-{{ glusterfs_name | default }}-endpoints"
  44. failed_when: False
  45. - name: Generate GlusterFS registry endpoints
  46. template:
  47. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-endpoints.yml.j2"
  48. dest: "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  49. - name: Copy GlusterFS registry service
  50. template:
  51. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-service.yml.j2"
  52. dest: "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  53. - name: Create GlusterFS registry endpoints
  54. oc_obj:
  55. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  56. state: present
  57. kind: endpoints
  58. name: "glusterfs-{{ glusterfs_name }}-endpoints"
  59. files:
  60. - "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  61. - name: Create GlusterFS registry service
  62. oc_obj:
  63. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  64. state: present
  65. kind: service
  66. name: "glusterfs-{{ glusterfs_name }}-endpoints"
  67. files:
  68. - "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  69. - name: Check if GlusterFS registry volume exists
  70. command: "{{ glusterfs_heketi_client }} volume list"
  71. register: registry_volume
  72. - name: Create GlusterFS registry volume
  73. command: "{{ glusterfs_heketi_client }} volume create --size={{ openshift.hosted.registry.storage.volume.size | replace('Gi','') }} --name={{ openshift.hosted.registry.storage.glusterfs.path }}"
  74. when: "openshift.hosted.registry.storage.glusterfs.path not in registry_volume.stdout"