diff --git a/installer/roles/kubernetes/tasks/openshift_auth.yml b/installer/roles/kubernetes/tasks/openshift_auth.yml index dac56d7a3b..6271eddf03 100644 --- a/installer/roles/kubernetes/tasks/openshift_auth.yml +++ b/installer/roles/kubernetes/tasks/openshift_auth.yml @@ -29,11 +29,16 @@ - name: OpenShift authentication failed on TLS verification fail: - msg: "Failed to verify TLS, consider settings openshift_skip_tls_verify=True {{ openshift_auth_result.stderr }}" + msg: "Failed to verify TLS, consider settings openshift_skip_tls_verify=True {{ openshift_auth_result.stderr | default('certificate does not match hostname') }}" when: - openshift_skip_tls_verify is not defined or not openshift_skip_tls_verify - - openshift_auth_result.rc != 0 - - openshift_auth_result.stderr | search("certificate that does not match its hostname") + - openshift_auth_result.rc is defined and openshift_auth_result.rc != 0 + - openshift_auth_result.stderr is defined and (openshift_auth_result.stderr | search("certificate that does not match its hostname")) + +- name: OpenShift authentication failed + fail: + msg: "{{ openshift_auth_result.stderr | default('Invalid credentials') }}" + when: openshift_auth_result.rc is defined and openshift_auth_result.rc != 0 - name: Authenticate with OpenShift via token shell: | @@ -47,5 +52,6 @@ - name: OpenShift authentication failed fail: - msg: "{{ openshift_auth_result.stderr }}" - when: openshift_auth_result.rc != 0 + msg: "{{ openshift_auth_result.stderr | default('Invalid token') }}" + when: openshift_auth_result.rc is defined and openshift_auth_result.rc != 0 +