main.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. ---
  2. - block:
  3. - name: Create passthrough route for docker-registry
  4. oc_route:
  5. kubeconfig: "{{ openshift_master_config_dir }}/admin.kubeconfig"
  6. name: docker-registry
  7. namespace: default
  8. service_name: docker-registry
  9. state: present
  10. tls_termination: passthrough
  11. register: docker_registry_route
  12. - name: Create passthrough route for registry-console
  13. oc_route:
  14. kubeconfig: "{{ openshift_master_config_dir }}/admin.kubeconfig"
  15. name: registry-console
  16. namespace: default
  17. service_name: registry-console
  18. state: present
  19. tls_termination: passthrough
  20. register: registry_console_cockpit_kube
  21. # XXX: Required for items still using command
  22. - name: Create temp directory for kubeconfig
  23. command: mktemp -d /tmp/openshift-ansible-XXXXXX
  24. register: mktemp
  25. changed_when: False
  26. - set_fact:
  27. openshift_hosted_kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  28. - name: Copy the admin client config(s)
  29. command: >
  30. cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ openshift_hosted_kubeconfig }}
  31. changed_when: False
  32. # TODO: Need to fix the origin and enterprise templates so that they both respect IMAGE_PREFIX
  33. - name: Deploy registry-console
  34. command: >
  35. {{ openshift.common.client_binary }} new-app --template=registry-console
  36. {% if openshift_cockpit_deployer_prefix is defined %}-p IMAGE_PREFIX="{{ openshift_cockpit_deployer_prefix }}"{% endif %}
  37. {% if openshift_cockpit_deployer_version is defined %}-p IMAGE_VERSION="{{ openshift_cockpit_deployer_version }}"{% endif %}
  38. -p OPENSHIFT_OAUTH_PROVIDER_URL="{{ openshift.master.public_api_url }}"
  39. -p REGISTRY_HOST="{{ docker_registry_route.results.results[0].spec.host }}"
  40. -p COCKPIT_KUBE_URL="https://{{ registry_console_cockpit_kube.results.results[0].spec.host }}"
  41. --config={{ openshift_hosted_kubeconfig }}
  42. -n default
  43. register: deploy_registry_console
  44. changed_when: "'already exists' not in deploy_registry_console.stderr"
  45. failed_when: "'already exists' not in deploy_registry_console.stderr and deploy_registry_console.rc != 0"
  46. - name: Delete temp directory
  47. file:
  48. name: "{{ mktemp.stdout }}"
  49. state: absent
  50. changed_when: False
  51. # XXX: End required for items still using command
  52. run_once: true