You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
failed: [x.x.x.x -> localhost] (item=[[{'cp_datacenter': 'DC03', 'cp_clusters': ['dc03-bsod', 'dc03-panic']}, 'dc03-bsod'], {'pvlan_pg_name': 'some-storage-client-isolated-pvlan', 'primary_pvlan_id': 1700, 'secondary_pvlan_id': 1701}]) => {"ansible_loop_var": "item", "changed": false, "item": [[{"cp_clusters": ["dc03-bsod", "dc03-panic"], "cp_datacenter": "DC03"}, "dc03-bsod"], {"primary_pvlan_id": 1700, "pvlan_pg_name": "some-storage-client-isolated-pvlan", "secondary_pvlan_id": 1701}], "module_stderr": "Traceback (most recent call last):\n File \"/var/home/mihkel/.ansible/tmp/ansible-tmp-1729598792.0353694-526397-181662945735310/AnsiballZ_vmware_dvswitch_pvlans.py\", line 107, in <module>\n _ansiballz_main()\n File \"/var/home/mihkel/.ansible/tmp/ansible-tmp-1729598792.0353694-526397-181662945735310/AnsiballZ_vmware_dvswitch_pvlans.py\", line 99, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/var/home/mihkel/.ansible/tmp/ansible-tmp-1729598792.0353694-526397-181662945735310/AnsiballZ_vmware_dvswitch_pvlans.py\", line 47, in invoke_module\n runpy.run_module(mod_name='ansible_collections.community.vmware.plugins.modules.vmware_dvswitch_pvlans', init_globals=dict(_module_fqn='ansible_collections.community.vmware.plugins.modules.vmware_dvswitch_pvlans', _modlib_path=modlib_path),\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_community.vmware.vmware_dvswitch_pvlans_payload_3vs2emf8/ansible_community.vmware.vmware_dvswitch_pvlans_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_pvlans.py\", line 527, in <module>\n File \"/tmp/ansible_community.vmware.vmware_dvswitch_pvlans_payload_3vs2emf8/ansible_community.vmware.vmware_dvswitch_pvlans_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_pvlans.py\", line 523, in main\n File \"/tmp/ansible_community.vmware.vmware_dvswitch_pvlans_payload_3vs2emf8/ansible_community.vmware.vmware_dvswitch_pvlans_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_pvlans.py\", line 259, in ensure\n File \"/tmp/ansible_community.vmware.vmware_dvswitch_pvlans_payload_3vs2emf8/ansible_community.vmware.vmware_dvswitch_pvlans_payload.zip/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_pvlans.py\", line 480, in create_pvlan_config_spec\n File \"/var/home/mihkel/virtual_envs/ansible/lib64/python3.12/site-packages/pyVmomi/VmomiSupport.py\", line 557, in __setattr__\n CheckField(self._GetPropertyInfo(name), val)\n File \"/var/home/mihkel/virtual_envs/ansible/lib64/python3.12/site-packages/pyVmomi/VmomiSupport.py\", line 1118, in CheckField\n raise TypeError('For \"%s\" expected type %s, but got %s' %\nTypeError: For \"primaryVlanId\" expected type int, but got str\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: For "primaryVlanId" expected type int, but got str
But if I define vlan_id's inside task as int, then it works:
- name: Debug taskdebug:
msg: "{{ item.1.primary_pvlan_id }} and type is {{ item.1.primary_pvlan_id | type_debug }}"loop: "{{ cp_vmware_structure | ansible.builtin.product(cp_pvlan_portgroups) }}"
outputs:
ok: [172.16.8.221] => (item=[{'cp_datacenter': 'DC02', 'cp_clusters': ['dc02-bsod', 'dc02-panic']}, {'pvlan_pg_name': 'some-storage-client-isolated-pvlan', 'primary_pvlan_id': 1700, 'secondary_pvlan_id': 1701}]) => {
"msg": "1700 and type is int"
}
ok: [172.16.8.221] => (item=[{'cp_datacenter': 'DC03', 'cp_clusters': ['dc03-bsod', 'dc03-panic']}, {'pvlan_pg_name': 'some-storage-client-isolated-pvlan', 'primary_pvlan_id': 1700, 'secondary_pvlan_id': 1701}]) => {
"msg": "1700 and type is int"
}
EXPECTED RESULTS
Reading int from variable should result in working task :)
ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: For "primaryVlanId" expected type int, but got str
The text was updated successfully, but these errors were encountered:
SUMMARY
Getting vlan_id's from variables results in type error
ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
This results in:
But if I define vlan_id's inside task as int, then it works:
Debug task
outputs:
EXPECTED RESULTS
Reading int from variable should result in working task :)
ACTUAL RESULTS
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: For "primaryVlanId" expected type int, but got str
The text was updated successfully, but these errors were encountered: