diff options
Diffstat (limited to 'roles/openshift_hosted/tasks/router/router.yml')
-rw-r--r-- | roles/openshift_hosted/tasks/router/router.yml | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/roles/openshift_hosted/tasks/router/router.yml b/roles/openshift_hosted/tasks/router/router.yml index c011db762..7f3731c7d 100644 --- a/roles/openshift_hosted/tasks/router/router.yml +++ b/roles/openshift_hosted/tasks/router/router.yml @@ -9,10 +9,15 @@ module: slurp src: "{{ item }}" register: openshift_router_certificate_output + # Defaulting dictionary keys to none to avoid deprecation warnings + # (future fatal errors) during template evaluation. Dictionary keys + # won't be accessed unless openshift_hosted_router_certificate is + # defined and has all keys (certfile, keyfile, cafile) which we + # check above. with_items: - - "{{ openshift_hosted_router_certificate.certfile }}" - - "{{ openshift_hosted_router_certificate.keyfile }}" - - "{{ openshift_hosted_router_certificate.cafile }}" + - "{{ (openshift_hosted_router_certificate | default({'certfile':none})).certfile }}" + - "{{ (openshift_hosted_router_certificate | default({'keyfile':none})).keyfile }}" + - "{{ (openshift_hosted_router_certificate | default({'cafile':none})).cafile }}" when: openshift_hosted_router_certificate is defined - name: Persist certificate contents @@ -27,7 +32,7 @@ content: "{{ openshift.hosted.router.certificate.contents }}" dest: "{{ openshift_master_config_dir }}/openshift-router.pem" mode: 0600 - when: openshift.hosted.router.certificate | default(none) is not none + when: "'certificate' in openshift.hosted.router and 'contents' in openshift.hosted.router.certificate" - name: Retrieve list of openshift nodes matching router selector command: > @@ -39,7 +44,7 @@ when: openshift.hosted.router.replicas | default(none) is none - set_fact: - replicas: "{{ openshift.hosted.router.replicas | default((openshift_hosted_router_nodes_json.stdout | from_json)['items'] | length) }}" + replicas: "{{ openshift.hosted.router.replicas | default((openshift_hosted_router_nodes_json.stdout | default('{\"items\":[]}') | from_json)['items'] | length) }}" - name: Create OpenShift router command: > @@ -48,7 +53,7 @@ {% if replicas > 1 -%} --replicas={{ replicas }} {% endif -%} - {% if openshift.hosted.router.certificate | default(none) is not none -%} + {% if 'certificate' in openshift.hosted.router and 'contents' in openshift.hosted.router.certificate -%} --default-cert={{ openshift_master_config_dir }}/openshift-router.pem {% endif -%} --namespace={{ openshift.hosted.router.namespace | default('default') }} |