main.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ---
  2. - name: Expose docker-registry
  3. command: >
  4. {{ openshift.common.client_binary }} expose service docker-registry -n default
  5. register: expose_docker_registry
  6. changed_when: "'already exists' not in expose_docker_registry.stderr"
  7. failed_when: "'already exists' not in expose_docker_registry.stderr and expose_docker_registry.rc != 0"
  8. - name: Create passthrough route for registry-console
  9. command: >
  10. {{ openshift.common.client_binary }} create route passthrough
  11. --service registry-console
  12. --port registry-console
  13. -n default
  14. register: create_registry_console_route
  15. changed_when: "'already exists' not in create_registry_console_route.stderr"
  16. failed_when: "'already exists' not in create_registry_console_route.stderr and create_registry_console_route.rc != 0"
  17. - name: Retrieve docker-registry route
  18. command: "{{ openshift.common.client_binary }} get route docker-registry -n default --template='{{ '{{' }} .spec.host {{ '}}' }}'"
  19. register: docker_registry_route
  20. failed_when: false
  21. changed_when: false
  22. - name: Retrieve cockpit kube url
  23. command: "{{ openshift.common.client_binary }} get route registry-console -n default --template='https://{{ '{{' }} .spec.host {{ '}}' }}'"
  24. register: registry_console_cockpit_kube_url
  25. failed_when: false
  26. changed_when: false
  27. - set_fact:
  28. cockpit_image_prefix: "{{ '-p IMAGE_PREFIX=' ~ openshift_cockpit_deployer_prefix | default('') }}"
  29. - name: Deploy registry-console
  30. command: >
  31. {{ openshift.common.client_binary }} new-app --template=registry-console
  32. {{ cockpit_image_prefix }}
  33. -p OPENSHIFT_OAUTH_PROVIDER_URL="{{ openshift.master.public_api_url }}"
  34. -p REGISTRY_HOST="{{ docker_registry_route.stdout }}"
  35. -p COCKPIT_KUBE_URL="{{ registry_console_cockpit_kube_url.stdout }}"
  36. -n default
  37. register: deploy_registry_console
  38. changed_when: "'already exists' not in deploy_registry_console.stderr"
  39. failed_when: "'already exists' not in deploy_registry_console.stderr and deploy_registry_console.rc != 0"