0

I want to install ovirt 4.5.4 hyperconverged cluster, three nodes and each node has one SSD and one HDD, and the ovirt node is installed on the SSD.I tried a few times but couldn't solve it.

Python 3.11.2 Ansible 2.14.2

If you need more details don't hesitate to ask.

playbook:

hc_nodes:
  hosts:
    node210.com:
      gluster_infra_volume_groups:
        - vgname: gluster_vg_sda
          pvname: /dev/sda
      gluster_infra_mount_devices:
        - path: /gluster_bricks/engine
          lvname: gluster_lv_engine
          vgname: gluster_vg_sda
        - path: /gluster_bricks/data
          lvname: gluster_lv_data
          vgname: gluster_vg_sda
        - path: /gluster_bricks/vmstore
          lvname: gluster_lv_vmstore
          vgname: gluster_vg_sda
      blacklist_mpath_devices:
        - sda
      gluster_infra_thick_lvs:
        - vgname: gluster_vg_sda
          lvname: gluster_lv_engine
          size: 100G
      gluster_infra_thinpools:
        - vgname: gluster_vg_sda
          thinpoolname: gluster_thinpool_gluster_vg_sda
          poolmetadatasize: 1G
      gluster_infra_lv_logicalvols:
        - vgname: gluster_vg_sda
          thinpool: gluster_thinpool_gluster_vg_sda
          lvname: gluster_lv_data
          lvsize: 150G
        - vgname: gluster_vg_sda
          thinpool: gluster_thinpool_gluster_vg_sda
          lvname: gluster_lv_vmstore
          lvsize: 150G
    node211.com:
      gluster_infra_volume_groups:
        - vgname: gluster_vg_sda
          pvname: /dev/sda
      gluster_infra_mount_devices:
        - path: /gluster_bricks/engine
          lvname: gluster_lv_engine
          vgname: gluster_vg_sda
        - path: /gluster_bricks/data
          lvname: gluster_lv_data
          vgname: gluster_vg_sda
        - path: /gluster_bricks/vmstore
          lvname: gluster_lv_vmstore
          vgname: gluster_vg_sda
      blacklist_mpath_devices:
        - sda
      gluster_infra_thick_lvs:
        - vgname: gluster_vg_sda
          lvname: gluster_lv_engine
          size: 100G
      gluster_infra_thinpools:
        - vgname: gluster_vg_sda
          thinpoolname: gluster_thinpool_gluster_vg_sda
          poolmetadatasize: 1G
      gluster_infra_lv_logicalvols:
        - vgname: gluster_vg_sda
          thinpool: gluster_thinpool_gluster_vg_sda
          lvname: gluster_lv_data
          lvsize: 150G
        - vgname: gluster_vg_sda
          thinpool: gluster_thinpool_gluster_vg_sda
          lvname: gluster_lv_vmstore
          lvsize: 150G
    node212.com:
      gluster_infra_volume_groups:
        - vgname: gluster_vg_sda
          pvname: /dev/sda
      gluster_infra_mount_devices:
        - path: /gluster_bricks/engine
          lvname: gluster_lv_engine
          vgname: gluster_vg_sda
        - path: /gluster_bricks/data
          lvname: gluster_lv_data
          vgname: gluster_vg_sda
        - path: /gluster_bricks/vmstore
          lvname: gluster_lv_vmstore
          vgname: gluster_vg_sda
      blacklist_mpath_devices:
        - sda
      gluster_infra_thick_lvs:
        - vgname: gluster_vg_sda
          lvname: gluster_lv_engine
          size: 100G
      gluster_infra_thinpools:
        - vgname: gluster_vg_sda
          thinpoolname: gluster_thinpool_gluster_vg_sda
          poolmetadatasize: 1G
      gluster_infra_lv_logicalvols:
        - vgname: gluster_vg_sda
          thinpool: gluster_thinpool_gluster_vg_sda
          lvname: gluster_lv_data
          lvsize: 150G
        - vgname: gluster_vg_sda
          thinpool: gluster_thinpool_gluster_vg_sda
          lvname: gluster_lv_vmstore
          lvsize: 150G
  vars:
    gluster_infra_disktype: JBOD
    gluster_set_selinux_labels: true
    gluster_infra_fw_ports:
      - 2049/tcp
      - 54321/tcp
      - 5900/tcp
      - 5900-6923/tcp
      - 5666/tcp
      - 16514/tcp
    gluster_infra_fw_permanent: true
    gluster_infra_fw_state: enabled
    gluster_infra_fw_zone: public
    gluster_infra_fw_services:
      - glusterfs
    gluster_features_force_varlogsizecheck: false
    cluster_nodes:
      - node210.com
      - node211.com
      - node212.com
    gluster_features_hci_cluster: '{{ cluster_nodes }}'
    gluster_features_hci_volumes:
      - volname: engine
        brick: /gluster_bricks/engine/engine
        arbiter: 0
      - volname: data
        brick: /gluster_bricks/data/data
        arbiter: 0
      - volname: vmstore
        brick: /gluster_bricks/vmstore/vmstore
        arbiter: 0

Error message:

TASK [gluster.infra/roles/backend_setup : Record for missing devices for phase 2] ***
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/vg_create.yml:49
skipping: [node210.com] => (item={'changed': True, 'stdout': '1', 'stderr': '', 'rc': 0, 'cmd': ' test -b /dev/sda && echo "1" || echo  "0"; \n', 'start': '2023-03-21 15:21:30.196747', 'end': '2023-03-21 15:21:30.199563', 'delta': '0:00:00.002816', 'msg': '', 'invocation': {'module_args': {'_raw_params': ' test -b /dev/sda && echo "1" || echo  "0"; \n', '_uses_shell': True, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stdout_lines': ['1'], 'stderr_lines': [], 'failed': False, 'item': {'key': 'gluster_vg_sda', 'value': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}, 'ansible_loop_var': 'item'})  => {"ansible_loop_var": "item", "changed": false, "item": {"ansible_loop_var": "item", "changed": true, "cmd": " test -b /dev/sda && echo \"1\" || echo  \"0\"; \n", "delta": "0:00:00.002816", "end": "2023-03-21 15:21:30.199563", "failed": false, "invocation": {"module_args": {"_raw_params": " test -b /dev/sda && echo \"1\" || echo  \"0\"; \n", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true}}, "item": {"key": "gluster_vg_sda", "value": [{"pvname": "/dev/sda", "vgname": "gluster_vg_sda"}]}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:30.196747", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}, "skip_reason": "Conditional result was False"}
skipping: [node210.com] => {"changed": false, "msg": "All items skipped"}
skipping: [node211.com] => (item={'changed': True, 'stdout': '1', 'stderr': '', 'rc': 0, 'cmd': ' test -b /dev/sda && echo "1" || echo  "0"; \n', 'start': '2023-03-21 15:21:30.448081', 'end': '2023-03-21 15:21:30.450268', 'delta': '0:00:00.002187', 'msg': '', 'invocation': {'module_args': {'_raw_params': ' test -b /dev/sda && echo "1" || echo  "0"; \n', '_uses_shell': True, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stdout_lines': ['1'], 'stderr_lines': [], 'failed': False, 'item': {'key': 'gluster_vg_sda', 'value': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}, 'ansible_loop_var': 'item'})  => {"ansible_loop_var": "item", "changed": false, "item": {"ansible_loop_var": "item", "changed": true, "cmd": " test -b /dev/sda && echo \"1\" || echo  \"0\"; \n", "delta": "0:00:00.002187", "end": "2023-03-21 15:21:30.450268", "failed": false, "invocation": {"module_args": {"_raw_params": " test -b /dev/sda && echo \"1\" || echo  \"0\"; \n", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true}}, "item": {"key": "gluster_vg_sda", "value": [{"pvname": "/dev/sda", "vgname": "gluster_vg_sda"}]}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:30.448081", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}, "skip_reason": "Conditional result was False"}
skipping: [node211.com] => {"changed": false, "msg": "All items skipped"}
skipping: [node212.com] => (item={'changed': True, 'stdout': '1', 'stderr': '', 'rc': 0, 'cmd': ' test -b /dev/sda && echo "1" || echo  "0"; \n', 'start': '2023-03-21 15:21:30.627938', 'end': '2023-03-21 15:21:30.631121', 'delta': '0:00:00.003183', 'msg': '', 'invocation': {'module_args': {'_raw_params': ' test -b /dev/sda && echo "1" || echo  "0"; \n', '_uses_shell': True, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stdout_lines': ['1'], 'stderr_lines': [], 'failed': False, 'item': {'key': 'gluster_vg_sda', 'value': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}, 'ansible_loop_var': 'item'})  => {"ansible_loop_var": "item", "changed": false, "item": {"ansible_loop_var": "item", "changed": true, "cmd": " test -b /dev/sda && echo \"1\" || echo  \"0\"; \n", "delta": "0:00:00.003183", "end": "2023-03-21 15:21:30.631121", "failed": false, "invocation": {"module_args": {"_raw_params": " test -b /dev/sda && echo \"1\" || echo  \"0\"; \n", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true}}, "item": {"key": "gluster_vg_sda", "value": [{"pvname": "/dev/sda", "vgname": "gluster_vg_sda"}]}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:30.627938", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}, "skip_reason": "Conditional result was False"}
skipping: [node212.com] => {"changed": false, "msg": "All items skipped"}

TASK [gluster.infra/roles/backend_setup : Print the gateway for each host when defined] ***
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/vg_create.yml:55
ok: [node210.com] => {
    "msg": "vg names {'gluster_vg_sda': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}"
}
ok: [node211.com] => {
    "msg": "vg names {'gluster_vg_sda': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}"
}
ok: [node212.com] => {
    "msg": "vg names {'gluster_vg_sda': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}"
}

TASK [gluster.infra/roles/backend_setup : Create volume groups] ****************
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/vg_create.yml:63
changed: [node210.com] => (item={'key': 'gluster_vg_sda', 'value': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}) => {"ansible_loop_var": "item", "changed": true, "cmd": ["vgcreate", "--dataalignment", "256K", "-s", "4", "gluster_vg_sda", "/dev/sda"], "delta": "0:00:00.376308", "end": "2023-03-21 15:21:31.992266", "item": {"key": "gluster_vg_sda", "value": [{"pvname": "/dev/sda", "vgname": "gluster_vg_sda"}]}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:31.615958", "stderr": "", "stderr_lines": [], "stdout": "  Physical volume \"/dev/sda\" successfully created.\n  Volume group \"gluster_vg_sda\" successfully created", "stdout_lines": ["  Physical volume \"/dev/sda\" successfully created.", "  Volume group \"gluster_vg_sda\" successfully created"]}
changed: [node212.com] => (item={'key': 'gluster_vg_sda', 'value': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}) => {"ansible_loop_var": "item", "changed": true, "cmd": ["vgcreate", "--dataalignment", "256K", "-s", "4", "gluster_vg_sda", "/dev/sda"], "delta": "0:00:00.186410", "end": "2023-03-21 15:21:32.250060", "item": {"key": "gluster_vg_sda", "value": [{"pvname": "/dev/sda", "vgname": "gluster_vg_sda"}]}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:32.063650", "stderr": "", "stderr_lines": [], "stdout": "  Physical volume \"/dev/sda\" successfully created.\n  Volume group \"gluster_vg_sda\" successfully created", "stdout_lines": ["  Physical volume \"/dev/sda\" successfully created.", "  Volume group \"gluster_vg_sda\" successfully created"]}
changed: [node211.com] => (item={'key': 'gluster_vg_sda', 'value': [{'vgname': 'gluster_vg_sda', 'pvname': '/dev/sda'}]}) => {"ansible_loop_var": "item", "changed": true, "cmd": ["vgcreate", "--dataalignment", "256K", "-s", "4", "gluster_vg_sda", "/dev/sda"], "delta": "0:00:00.552988", "end": "2023-03-21 15:21:32.590708", "item": {"key": "gluster_vg_sda", "value": [{"pvname": "/dev/sda", "vgname": "gluster_vg_sda"}]}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:32.037720", "stderr": "", "stderr_lines": [], "stdout": "  Physical volume \"/dev/sda\" successfully created.\n  Volume group \"gluster_vg_sda\" successfully created", "stdout_lines": ["  Physical volume \"/dev/sda\" successfully created.", "  Volume group \"gluster_vg_sda\" successfully created"]}

TASK [gluster.infra/roles/backend_setup : update LVM fact's] *******************
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/vg_create.yml:76
ok: [node210.com]
ok: [node211.com]
ok: [node212.com]

TASK [gluster.infra/roles/backend_setup : Check if thick-lv block devices exists] ***
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thick_lv_create.yml:3
changed: [node210.com] => (item={'vgname': 'gluster_vg_sda', 'lvname': 'gluster_lv_engine', 'size': '100G'}) => {"ansible_loop_var": "item", "changed": true, "cmd": " echo \"1\" \n", "delta": "0:00:00.002889", "end": "2023-03-21 15:21:34.660635", "item": {"lvname": "gluster_lv_engine", "size": "100G", "vgname": "gluster_vg_sda"}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:34.657746", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}
changed: [node211.com] => (item={'vgname': 'gluster_vg_sda', 'lvname': 'gluster_lv_engine', 'size': '100G'}) => {"ansible_loop_var": "item", "changed": true, "cmd": " echo \"1\" \n", "delta": "0:00:00.002132", "end": "2023-03-21 15:21:35.093966", "item": {"lvname": "gluster_lv_engine", "size": "100G", "vgname": "gluster_vg_sda"}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:35.091834", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}
changed: [node212.com] => (item={'vgname': 'gluster_vg_sda', 'lvname': 'gluster_lv_engine', 'size': '100G'}) => {"ansible_loop_var": "item", "changed": true, "cmd": " echo \"1\" \n", "delta": "0:00:00.003040", "end": "2023-03-21 15:21:35.271672", "item": {"lvname": "gluster_lv_engine", "size": "100G", "vgname": "gluster_vg_sda"}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:35.268632", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}

TASK [gluster.infra/roles/backend_setup : Record for missing devices for phase 2] ***
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thick_lv_create.yml:16
skipping: [node210.com] => (item={'changed': True, 'stdout': '1', 'stderr': '', 'rc': 0, 'cmd': ' echo "1" \n', 'start': '2023-03-21 15:21:34.657746', 'end': '2023-03-21 15:21:34.660635', 'delta': '0:00:00.002889', 'msg': '', 'invocation': {'module_args': {'_raw_params': ' echo "1" \n', '_uses_shell': True, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stdout_lines': ['1'], 'stderr_lines': [], 'failed': False, 'item': {'vgname': 'gluster_vg_sda', 'lvname': 'gluster_lv_engine', 'size': '100G'}, 'ansible_loop_var': 'item'})  => {"ansible_loop_var": "item", "changed": false, "item": {"ansible_loop_var": "item", "changed": true, "cmd": " echo \"1\" \n", "delta": "0:00:00.002889", "end": "2023-03-21 15:21:34.660635", "failed": false, "invocation": {"module_args": {"_raw_params": " echo \"1\" \n", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true}}, "item": {"lvname": "gluster_lv_engine", "size": "100G", "vgname": "gluster_vg_sda"}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:34.657746", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}, "skip_reason": "Conditional result was False"}
skipping: [node210.com] => {"changed": false, "msg": "All items skipped"}
skipping: [node211.com] => (item={'changed': True, 'stdout': '1', 'stderr': '', 'rc': 0, 'cmd': ' echo "1" \n', 'start': '2023-03-21 15:21:35.091834', 'end': '2023-03-21 15:21:35.093966', 'delta': '0:00:00.002132', 'msg': '', 'invocation': {'module_args': {'_raw_params': ' echo "1" \n', '_uses_shell': True, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stdout_lines': ['1'], 'stderr_lines': [], 'failed': False, 'item': {'vgname': 'gluster_vg_sda', 'lvname': 'gluster_lv_engine', 'size': '100G'}, 'ansible_loop_var': 'item'})  => {"ansible_loop_var": "item", "changed": false, "item": {"ansible_loop_var": "item", "changed": true, "cmd": " echo \"1\" \n", "delta": "0:00:00.002132", "end": "2023-03-21 15:21:35.093966", "failed": false, "invocation": {"module_args": {"_raw_params": " echo \"1\" \n", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true}}, "item": {"lvname": "gluster_lv_engine", "size": "100G", "vgname": "gluster_vg_sda"}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:35.091834", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}, "skip_reason": "Conditional result was False"}
skipping: [node211.com] => {"changed": false, "msg": "All items skipped"}
skipping: [node212.com] => (item={'changed': True, 'stdout': '1', 'stderr': '', 'rc': 0, 'cmd': ' echo "1" \n', 'start': '2023-03-21 15:21:35.268632', 'end': '2023-03-21 15:21:35.271672', 'delta': '0:00:00.003040', 'msg': '', 'invocation': {'module_args': {'_raw_params': ' echo "1" \n', '_uses_shell': True, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stdout_lines': ['1'], 'stderr_lines': [], 'failed': False, 'item': {'vgname': 'gluster_vg_sda', 'lvname': 'gluster_lv_engine', 'size': '100G'}, 'ansible_loop_var': 'item'})  => {"ansible_loop_var": "item", "changed": false, "item": {"ansible_loop_var": "item", "changed": true, "cmd": " echo \"1\" \n", "delta": "0:00:00.003040", "end": "2023-03-21 15:21:35.271672", "failed": false, "invocation": {"module_args": {"_raw_params": " echo \"1\" \n", "_uses_shell": true, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true}}, "item": {"lvname": "gluster_lv_engine", "size": "100G", "vgname": "gluster_vg_sda"}, "msg": "", "rc": 0, "start": "2023-03-21 15:21:35.268632", "stderr": "", "stderr_lines": [], "stdout": "1", "stdout_lines": ["1"]}, "skip_reason": "Conditional result was False"}
skipping: [node212.com] => {"changed": false, "msg": "All items skipped"}

TASK [gluster.infra/roles/backend_setup : include_tasks] ***********************
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/thick_lv_create.yml:23
included: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/get_vg_groupings.yml for node210.com, node211.com, node212.com

TASK [gluster.infra/roles/backend_setup : Group devices by volume group name, including existing devices] ***
task path: /etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/get_vg_groupings.yml:3
fatal: [node210.com]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'str object' has no attribute 'vgname'. '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"}
fatal: [node211.com]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'str object' has no attribute 'vgname'. '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"}
fatal: [node212.com]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'str object' has no attribute 'vgname'. '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"}

/etc/ansible/roles/gluster.infra/roles/backend_setup/tasks/get_vg_groupings.yml

[root@node210 tasks]# cat get_vg_groupings.yml
---

- name: Group devices by volume group name, including existing devices
  set_fact:
   gluster_volumes_by_groupname_pre: >-
    {%- set output={} -%}
    {%- for grouper, devicesConf in volume_groups | groupby('vgname') -%}
      {%- set confs=[] -%}    
      {%- for deviceConf in devicesConf -%}
        {%- if deviceConf.pvname is defined -%}
          {%- for device in deviceConf.pvname.split(',') -%}
            {%- set deviceConfCln=dict(devicesConf | first) -%}
            {{- deviceConfCln.__setitem__('pvname',device | trim) -}}
            {{- confs.append(deviceConfCln) -}}
          {%- endfor -%}
        {%- endif -%}
      {%- endfor -%}
      {{- output.__setitem__(grouper, confs) -}}      
    {%- endfor -%}
    {%- if  hostvars[inventory_hostname].ansible_lvm is defined and hostvars[inventory_hostname].ansible_lvm.pvs is defined -%}
      {%- for device, pvs in hostvars[inventory_hostname].ansible_lvm.pvs.items() -%}
        {%- if pvs.vg in output and output[pvs.vg] | selectattr('pvname','equalto',device) | list | count == 0 -%}
          {{- output[pvs.vg].append({'pvname':device, 'vgname':pvs.vg }) -}}
        {%- endif -%}
      {%- endfor -%}
    {%- endif -%}
    {{- output | to_json -}}    

- name: Check if vg block device exists
  shell: >
   {% for pvsname in item.value | ovirt.ovirt.json_query('[].pvname')  %}
   test -b {{ pvsname }} && echo "1" || echo  "0";
   {% endfor %}
  register: vg_device_exists
  loop: "{{gluster_volumes_by_groupname_pre | dict2items}}"

- name: Filter none-existing devices
  set_fact:
   gluster_volumes_by_groupname: >-
    {%- set output={} -%}
    {%- for vgname, devicesConf in gluster_volumes_by_groupname_pre.items() -%}
      {%- for item in vg_device_exists.results | ovirt.ovirt.json_query('[?item.key==`' ~ vgname ~ '`]') -%}
        {%- set confs=[] -%}
        {%- for vgConfig in item.item.value -%}
            {%- if item.stdout_lines is defined and item.stdout_lines[loop.index0] == "1" -%}
              {%- set vgConfigCln=dict(item.item.value | first) -%}
              {{- vgConfigCln.__setitem__('pvname',vgConfig.pvname) -}}
              {{- confs.append(vgConfigCln) -}}
            {%- endif -%}
        {%- endfor -%}
        {{- output.__setitem__(vgname, confs) -}}
      {%- endfor -%}
    {%- endfor -%}
    {{- output | to_json -}}

The content is the same as that of the glusterfs github repository: https://github.com/gluster/gluster-ansible-infra/tree/master/roles

  • 2
    You will generally get better results on stackoverflow if you publish enough code to reproduce the error. – Matt Blaha Mar 22 '23 at 01:50
  • Please don't post textual content as screenshots; it impairs searching, is hard to read, and is explicitly mentioned in the [how to ask](https://stackoverflow.com/help/how-to-ask) page – mdaniel Mar 22 '23 at 02:09
  • @Matt Blaha Sorry, updated. – charnet1019 Mar 22 '23 at 02:33
  • Please read the [how to ask](https://stackoverflow.com/help/how-to-ask) page, and pay especial attention to the [MCVE](https://stackoverflow.com/help/mcve) section because I hope you can appreciate that without the ability to run your example, or without you doing any troubleshooting on your own, we are left to _guess_ what the problem is. Try adding `- debug: var=volume_groups` above that `set_fact:` to ensure that variable contains what you think it does – mdaniel Mar 22 '23 at 14:58
  • (a) don't put code in comments, they're terrible for that (b) fine, if you found a solution then [post and accept your own answer](https://stackoverflow.com/help/self-answer) – mdaniel Mar 23 '23 at 03:45

1 Answers1

1

Resolved, caused by the ansible version.

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