glusterfs_registry.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. - name: Delete pre-existing GlusterFS registry resources
  3. oc_obj:
  4. namespace: "{{ openshift_storage_glusterfs_namespace }}"
  5. kind: "{{ item.kind }}"
  6. name: "{{ item.name | default(omit) }}"
  7. selector: "{{ item.selector | default(omit) }}"
  8. state: absent
  9. with_items:
  10. - kind: "svc,ep"
  11. name: "glusterfs-registry-endpoints"
  12. failed_when: False
  13. - name: Generate GlusterFS registry endpoints
  14. template:
  15. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-endpoints.yml.j2"
  16. dest: "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  17. - name: Copy GlusterFS registry service
  18. copy:
  19. src: "{{ openshift.common.examples_content_version }}/glusterfs-registry-service.yml"
  20. dest: "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  21. - name: Create GlusterFS registry endpoints
  22. oc_obj:
  23. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  24. state: present
  25. kind: endpoints
  26. name: glusterfs-registry-endpoints
  27. files:
  28. - "{{ mktemp.stdout }}/glusterfs-registry-endpoints.yml"
  29. - name: Create GlusterFS registry service
  30. oc_obj:
  31. namespace: "{{ openshift.hosted.registry.namespace | default('default') }}"
  32. state: present
  33. kind: service
  34. name: glusterfs-registry-endpoints
  35. files:
  36. - "{{ mktemp.stdout }}/glusterfs-registry-service.yml"
  37. - name: Check if GlusterFS registry volume exists
  38. command: "heketi-cli -s http://{{ openshift_storage_glusterfs_heketi_url }} --user admin --secret '{{ openshift_storage_glusterfs_heketi_admin_key }}' volume list"
  39. register: registry_volume
  40. - name: Create GlusterFS registry volume
  41. command: "heketi-cli -s http://{{ openshift_storage_glusterfs_heketi_url }} --user admin --secret '{{ openshift_storage_glusterfs_heketi_admin_key }}' volume create --size={{ openshift.hosted.registry.storage.volume.size | replace('Gi','') }} --name={{ openshift.hosted.registry.storage.glusterfs.path }}"
  42. when: "'openshift.hosted.registry.storage.glusterfs.path' not in registry_volume.stdout"