IBM / cloud-pak-deployer

Configuration-based installation of OpenShift and Cloud Pak for Data/Integration/Watson AIOps on various private and public cloud infrastructure providers. Deployment attempts to achieve the end-state defined in the configuration. If something fails along the way, you only need to restart the process to continue the deployment.
https://ibm.github.io/cloud-pak-deployer/
Apache License 2.0
131 stars 66 forks source link

CP Deployer fails in existing-ocp-login-oc-login.yml #594

Closed semccombe closed 7 months ago

semccombe commented 7 months ago

When installing CP4D 4.8.0 on Openshift 4.12

we observed the following issue:

TASK [openshift-login : Login to OpenShift cluster if oc login command was found in secret cow-oc-login] * task path: /cloud-pak-deployer/automation-roles/99-generic/openshift/openshift-login/tasks/existing-ocp-login-oc-login.yml:3 Friday 01 December 2023 23:48:01 +0000 (0:00:00.091) 0:01:27.695 ***** <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/cpd-status/tmp"&& mkdir "echo /root/cpd-status/tmp/ansible-tmp-1701474481.9202313-2182-212452909709695" && echo ansible-tmp-1701474481.9202313-2182-212452909709695="echo /root/cpd-status/tmp/ansible-tmp-1701474481.9202313-2182-212452909709695" ) && sleep 0' Using module file /usr/local/lib/python3.8/site-packages/ansible/modules/command.py <127.0.0.1> PUT /opt/ansible/.ansible/tmp/ansible-local-31jv9xbop5/tmpstoux177 TO /root/cpd-status/tmp/ansible-tmp-1701474481.9202313-2182-212452909709695/AnsiballZ_command.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/cpd-status/tmp/ansible-tmp-1701474481.9202313-2182-212452909709695/ /root/cpd-status/tmp/ansible-tmp-1701474481.9202313-2182-212452909709695/AnsiballZ_command.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'KUBECONFIG=/root/cpd-status/openshift/kubeconfig /usr/bin/python3.8 /root/cpd-status/tmp/ansible-tmp-1701474481.9202313-2182-212452909709695/AnsiballZ_command.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/cpd-status/tmp/ansible-tmp-1701474481.9202313-2182-212452909709695/ > /dev/null 2>&1 && sleep 0' changed: [localhost] => changed=true attempts: 1 cmd: |- oc login --insecure-skip-tls-verify=true --token=sha256~E73iEUHI8ZbJpPoJOiSncpWciE_YDweOfd6VdW2sDHg --server=https://api.cow.cp.fyre.ibm.com:6443/ delta: '0:00:00.242466' end: '2023-12-01 23:48:02.538875' failed_when_result: false invocation: module_args: _raw_params: |- oc login --insecure-skip-tls-verify=true --token=sha256~E73iEUHI8ZbJpPoJOiSncpWciE_YDweOfd6VdW2sDHg --server=https://api.cow.cp.fyre.ibm.com:6443/ _uses_shell: true argv: null chdir: null creates: null executable: null removes: null stdin: null stdin_add_newline: true strip_empty_ends: true warn: true msg: '' rc: 0 start: '2023-12-01 23:48:02.296409' stderr: '' stderr_lines: stdout: |- WARNING: Using insecure TLS client config. Setting this option is not supported!

Logged into "https://api.cow.cp.fyre.ibm.com:6443/" as "kube:admin" using the token provided.

You have access to 74 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".

stdout_lines:

TASK [openshift-login : Login to OpenShift cluster if oc login command was found in secret oc-login] * task path: /cloud-pak-deployer/automation-roles/99-generic/openshift/openshift-login/tasks/existing-ocp-login-oc-login.yml:13 Friday 01 December 2023 23:48:02 +0000 (0:00:00.765) 0:01:28.461 ***** skipping: [localhost] => changed=false skip_reason: Conditional result was False

TASK [openshift-login : Show OpenShift login result] ***** task path: /cloud-pak-deployer/automation-roles/99-generic/openshift/openshift-login/tasks/existing-ocp-login-oc-login.yml:25 Friday 01 December 2023 23:48:02 +0000 (0:00:00.059) 0:01:28.521 * ok: [localhost] => msg: changed: false skip_reason: Conditional result was False skipped: true

TASK [openshift-login : fail] ** task path: /cloud-pak-deployer/automation-roles/99-generic/openshift/openshift-login/tasks/existing-ocp-login-oc-login.yml:29 Friday 01 December 2023 23:48:02 +0000 (0:00:00.062) 0:01:28.583 *** fatal: [localhost]: FAILED! => msg: |- The conditional check '_oc_login_result.rc != 0' failed. The error was: error while evaluating conditional (_oc_login_result.rc != 0): 'dict object' has no attribute 'rc'

The error appears to be in '/cloud-pak-deployer/automation-roles/99-generic/openshift/openshift-login/tasks/existing-ocp-login-oc-login.yml': line 29, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:
- fail:
  ^ here

PLAY RECAP ***** localhost : ok=289 changed=16 unreachable=0 failed=1 skipped=139 rescued=0 ignored=0

We were able to work around this issue by commenting parts of the existing-ocp-login-oc-login.yml file as follows:


Log in using oc login command

- name: Login to OpenShift cluster if oc login command was found in secret oc-login

shell: |

{{ _oc_login_generic }}

register: _oc_login_result

failed_when: False

retries: "{{ _ocp_login_retries }}"

delay: "{{ _ocp_login_delay }}"

until: _oc_login_result.rc==0

when:

- _oc_login_generic != ''

- _oc_login_cluster == ''