diff --git a/playbooks/roles/ocp-csi-driver/README.md b/playbooks/roles/ocp-csi-driver/README.md index cf0bcd3df..1faba7f5c 100644 --- a/playbooks/roles/ocp-csi-driver/README.md +++ b/playbooks/roles/ocp-csi-driver/README.md @@ -15,8 +15,9 @@ Requirements - Running OCP 4.x cluster is needed. - Cluster must not contain default StorageClass. -- A secret with PowerVC certificate in the `default` namespace. - Secret name must be `powervc-certificate` and must contains `certificate` field. +- Optional : +- A secret with PowerVC certificate in the `default` namespace + Secret name should be `powervc-certificate` and must contains `certificate` field. eg. ``` diff --git a/playbooks/roles/ocp-csi-driver/tasks/main.yml b/playbooks/roles/ocp-csi-driver/tasks/main.yml index 062f1e137..87b5b3823 100644 --- a/playbooks/roles/ocp-csi-driver/tasks/main.yml +++ b/playbooks/roles/ocp-csi-driver/tasks/main.yml @@ -117,17 +117,22 @@ name: powervc-certificate namespace: default register: powervc_certificate + ignore_errors: yes - - name: Fail if the powervc-certificate does not exists in default namespace - fail: + - name: If the powervc-certificate does not exists in default namespace + debug: msg: "PowerVC certificate secret is not present!" when: powervc_certificate.resources | length == 0 - - fail: + - name: Debug if the PowerVC certificate is empty or missing + debug: msg: "PowerVC certificate is empty! Please check the certificate's secret." - when: > - (powervc_certificate.resources[0].data.certificate is not defined) or - (powervc_certificate.resources[0].data.certificate | length == 0) + when: + powervc_certificate.resources | length != 0 and + ( + powervc_certificate.resources[0].data.certificate is not defined or + powervc_certificate.resources[0].data.certificate | length == 0 + ) - name: Create namespace for CSI driver validation k8s: