summaryrefslogtreecommitdiffstats
path: root/roles/openshift_hosted/tasks/registry/secure/passthrough.yml
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-08-21 12:01:23 -0400
committerGitHub <noreply@github.com>2017-08-21 12:01:23 -0400
commit00afac6ef3235ab66e0a0c02cc863cb577e127f2 (patch)
treefa670830ffe60719abc0ec150a91a608c38bec80 /roles/openshift_hosted/tasks/registry/secure/passthrough.yml
parent23da41c1fb3736b10e07774000e3a2bca028806e (diff)
parentd7d97964f5e3b5d2df9985e7f9d7b74a974458cb (diff)
downloadopenshift-00afac6ef3235ab66e0a0c02cc863cb577e127f2.tar.gz
openshift-00afac6ef3235ab66e0a0c02cc863cb577e127f2.tar.bz2
openshift-00afac6ef3235ab66e0a0c02cc863cb577e127f2.tar.xz
openshift-00afac6ef3235ab66e0a0c02cc863cb577e127f2.zip
Merge pull request #4254 from dmsimard/registry_certs
Refactor openshift_hosted's docker-registry route setup
Diffstat (limited to 'roles/openshift_hosted/tasks/registry/secure/passthrough.yml')
-rw-r--r--roles/openshift_hosted/tasks/registry/secure/passthrough.yml45
1 files changed, 45 insertions, 0 deletions
diff --git a/roles/openshift_hosted/tasks/registry/secure/passthrough.yml b/roles/openshift_hosted/tasks/registry/secure/passthrough.yml
new file mode 100644
index 000000000..5b44fda10
--- /dev/null
+++ b/roles/openshift_hosted/tasks/registry/secure/passthrough.yml
@@ -0,0 +1,45 @@
+---
+# Generate a self-signed certificate when there is no user-supplied certificate
+- name: Configure self-signed certificate file paths
+ set_fact:
+ docker_registry_cert_path: "{{ openshift_master_config_dir }}/registry.crt"
+ docker_registry_key_path: "{{ openshift_master_config_dir }}/registry.key"
+ docker_registry_cacert_path: "{{ openshift_master_config_dir }}/ca.crt"
+ docker_registry_self_signed: true
+ when:
+ - "'certfile' not in openshift_hosted_registry_routecertificates"
+ - "'keyfile' not in openshift_hosted_registry_routecertificates"
+
+# Retrieve user supplied certificate files if they are provided
+- when:
+ - "'certfile' in openshift_hosted_registry_routecertificates"
+ - "'keyfile' in openshift_hosted_registry_routecertificates"
+ block:
+ - name: Configure provided certificate file paths
+ set_fact:
+ docker_registry_cert_path: "{{ openshift_master_config_dir }}/named_certificates/{{ openshift_hosted_registry_routecertificates['certfile'] | basename }}"
+ docker_registry_key_path: "{{ openshift_master_config_dir }}/named_certificates/{{ openshift_hosted_registry_routecertificates['keyfile'] | basename }}"
+ docker_registry_self_signed: false
+
+ # Since we end up bundling the cert, cacert and key in a .pem file, the 'cafile'
+ # is optional
+ - name: Configure provided ca certificate file path
+ set_fact:
+ docker_registry_cacert_path: "{{ openshift_master_config_dir }}/named_certificates/{{ openshift_hosted_registry_routecertificates['cafile'] | basename }}"
+ when: "'cafile' in openshift_hosted_registry_routecertificates"
+
+ - name: Retrieve provided certificate files
+ copy:
+ backup: True
+ dest: "{{ openshift_master_config_dir }}/named_certificates/{{ item.value | basename }}"
+ src: "{{ item.value }}"
+ when: item.key in ['certfile', 'keyfile', 'cafile'] and item.value
+ with_dict: "{{ openshift_hosted_registry_routecertificates }}"
+
+- name: Configure a passthrough route for docker-registry
+ oc_route:
+ name: docker-registry
+ namespace: "{{ openshift_hosted_registry_namespace }}"
+ service_name: docker-registry
+ tls_termination: "{{ openshift_hosted_registry_routetermination }}"
+ host: "{{ openshift_hosted_registry_routehost | default(omit, true) }}"