summaryrefslogtreecommitdiffstats
path: root/roles/openshift_hosted/tasks/registry/storage/persistent_volume.yml
blob: 60eefd71a09f58fb42e66c283e5cf10f34e0142c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
- set_fact:
    registry_volume_claim: "{{ openshift.hosted.registry.storage.volume.name }}-claim"

- name: Determine if volume is already attached to dc/docker-registry
  command: "{{ openshift.common.client_binary }} get -o template dc/docker-registry --template=\\{\\{.spec.template.spec.volumes\\}\\} --output-version=v1"
  changed_when: false
  failed_when: false
  register: registry_volumes_output

- set_fact:
    volume_attached: "{{ registry_volume_claim in (registry_volumes_output).stdout | default(['']) }}"

- name: Add volume to dc/docker-registry
  command: >
    {{ openshift.common.client_binary }} volume dc/docker-registry
    --add --overwrite -t persistentVolumeClaim --claim-name={{ registry_volume_claim }}
    --name=registry-storage
  when: not volume_attached | bool