main.yml 1.3 KB

12345678910111213141516171819202122232425262728
  1. ---
  2. - set_fact: _oreg_images="--images='{{ openshift.master.registry_url }}'"
  3. - set_fact: _oreg_selector="--selector='{{ openshift.master.registry_selector }}'"
  4. - name: Deploy OpenShift Registry
  5. command: >
  6. {{ openshift.common.admin_binary }} registry
  7. --create --service-account=registry {{ _oreg_selector }}
  8. --credentials={{ openshift_master_config_dir }}/openshift-registry.kubeconfig {{ _oreg_images }}
  9. register: _oreg_results
  10. changed_when: "'service exists' not in _oreg_results.stdout"
  11. - name: Determine if nfs volume is already attached
  12. command: "{{ openshift.common.client_binary }} get -o template dc/docker-registry --template=\\{\\{.spec.template.spec.volumes\\}\\}"
  13. register: registry_volumes_output
  14. when: attach_registry_volume | bool
  15. - set_fact:
  16. volume_already_attached: "{{ 'server:' + nfs_host in registry_volumes_output.stdout and 'path:' + registry_volume_path in registry_volumes_output.stdout }}"
  17. when: attach_registry_volume | bool
  18. - name: Add nfs volume to dc/docker-registry
  19. command: >
  20. {{ openshift.common.client_binary }} volume dc/docker-registry
  21. --add --overwrite --name=registry-storage --mount-path=/registry
  22. --source='{"nfs": {"server": "{{ nfs_host }}", "path": "{{ registry_volume_path }}"}}'
  23. when: attach_registry_volume | bool and not volume_already_attached | bool