persistent_volume.yml 759 B

123456789101112131415161718
  1. ---
  2. - set_fact:
  3. registry_volume_claim: "{{ openshift.hosted.registry.storage.volume.name }}-claim"
  4. - name: Determine if volume is already attached to dc/docker-registry
  5. command: "{{ openshift.common.client_binary }} get -o template dc/docker-registry --template=\\{\\{.spec.template.spec.volumes\\}\\} --output-version=v1"
  6. changed_when: false
  7. register: registry_volumes_output
  8. - set_fact:
  9. volume_attached: "{{ registry_volume_claim in registry_volumes_output.stdout }}"
  10. - name: Add volume to dc/docker-registry
  11. command: >
  12. {{ openshift.common.client_binary }} volume dc/docker-registry
  13. --add --overwrite -t persistentVolumeClaim --claim-name={{ registry_volume_claim }}
  14. --name=registry-storage
  15. when: not volume_attached | bool