gluster / gluster-ansible-infra

Ansible role to enable and deploy the backend of a Gluster cluster.
GNU General Public License v3.0
28 stars 36 forks source link

backend_setup role fails with ansible-core 2.13.3 and Python 3.9 #135

Closed anoopcs9 closed 4 months ago

anoopcs9 commented 2 years ago

We have been noticing the following failure since the update to ansible 2.13.3 with its dependency on Python 3.9 on CentOS Stream 8:

TASK [gluster.infra/roles/backend_setup : Group devices by volume group name, including existing devices] ***
fatal: [storage0]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was:
'str object' has no attribute 'vgname'\n\nThe error appears to be in '/etc/ansible/roles/gluster.infra/roles/
backend_setup/task/get_vg_groupings.yml': line 3, column 3, but may\nbe elsewhere in the file depending on
the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Group devices by volume group
name, including existing devices\n  ^ here\n"}
fatal: [storage1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was:
'str object' has no attribute 'vgname'\n\nThe error appears to be in '/etc/ansible/roles/gluster.infra/roles/
backend_setup/tasks/get_vg_groupings.yml': line 3, column 3, but may\nbe elsewhere in the file depending on
the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Group devices by volume group
name, including existing devices\n  ^ here\n"}
anoopcs9 commented 2 years ago

It seems like a regression with Ansible v2.12 was helping us hide this issue till it was fixed with v2.13. Quoting some points from various related issues from Ansible:

Therefore we must refrain from using to_json filter on variables within Jinja2 template.

Issue references: https://github.com/ansible/ansible/issues/77004, https://github.com/ansible/ansible/issues/76443

dkelson commented 1 year ago

This makes it so oVirt 4.5.4 with ovirt-node-ng-installer-latest-el8.iso (currently links to 4.5.4-2022120615) won't install.

itg-dave commented 1 year ago

Until #136 is merged:

sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/get_vg_groupings.yml
sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thick_lv_create.yml
sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thin_pool_create.yml
sed -i 's/output | to_json/output/' /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thin_volume_create.yml
anoopcs9 commented 4 months ago

Fixed by #136