ibm-mas / ansible-devops

Ansible collection supporting devops for IBM Maximo Application Suite
https://ibm-mas.github.io/ansible-devops/
Eclipse Public License 2.0
49 stars 88 forks source link

ocp provision role for roks is broken when there is no pre-existing vlan #433

Open aroute opened 2 years ago

aroute commented 2 years ago

https://github.com/ibm-mas/ansible-devops/tree/master/ibm/mas_devops/roles/ocp_provision

TASK [ibm.mas_devops.ocp_provision : roks : Configure Private and Public Vlans] ******************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: list index out of range
fatal: [localhost]: FAILED! => {"changed": false}
TASK [ibm.mas_devops.ocp_provision : roks : Configure Private and Public Vlans] ****************
task path: /opt/app-root/lib64/python3.9/site-packages/ansible_collections/ibm/mas_devops/roles/ocp_provision/tasks/providers/roks.yml:88
The full traceback is:
Traceback (most recent call last):
  File "/opt/app-root/lib64/python3.9/site-packages/ansible/executor/task_executor.py", line 515, in _execute
    self._task.post_validate(templar=templar)
  File "/opt/app-root/lib64/python3.9/site-packages/ansible/playbook/task.py", line 285, in post_validate
    super(Task, self).post_validate(templar)
  File "/opt/app-root/lib64/python3.9/site-packages/ansible/playbook/base.py", line 650, in post_validate
    value = templar.template(getattr(self, name))
  File "/opt/app-root/lib64/python3.9/site-packages/ansible/template/__init__.py", line 930, in template
    d[k] = self.template(
  File "/opt/app-root/lib64/python3.9/site-packages/ansible/template/__init__.py", line 886, in template
    result = self.do_template(
  File "/opt/app-root/lib64/python3.9/site-packages/ansible/template/__init__.py", line 1160, in do_template
    res = j2_concat(rf)
  File "<template>", line 24, in root
  File "/opt/app-root/lib64/python3.9/site-packages/ansible/template/__init__.py", line 298, in wrapper
    ret = func(*args, **kwargs)
  File "/opt/app-root/lib64/python3.9/site-packages/ansible_collections/ibm/mas_devops/plugins/filter/filters.py", line 49, in public_vlan
    public_vlan = [x['id'] for x in vlans if x['type'] == 'public'][0]
IndexError: list index out of range
fatal: [localhost]: FAILED! => {
    "changed": false
}
andrercm commented 1 year ago

We need to find a way to create vlan's for IBM Cloud accounts that does not have any to host the OCP clusters. Workaround is to create the VLans via IBM Cloud UI. It's a valid enhancement.