how to deploy vm in DVS switch through ansible script

hi All,
Need help to deploy vm in Distributed virtual switch. Whenever i will deploy default it takes Standard port. what options we need

networks:

  • vlan: {{ vlan }}
    type: “static”
    device_type: vmxnet3
    ip: “{{ ip_addr }}”
    gateway: x.x.x.x
    netmask: x.x.x.x
    network: test-DVS1
    network_type: dvs

Which module are you using ?
Because your syntaxe looks like a mix of vmware_guest and vsphere_guest

vmware_guest

If I refer to the vmware_guest doc (https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html), there is no network and network_type parameters.

It is using the name parameter :
networks :

  • name: name of the portgroup

Warning : if you have several portgroups with the same name, it will fail :
https://github.com/ansible/ansible/issues/41781

hi Thanks for the response. Could you please help me how to get the port group information. Is there any module available in ansible or vmware guide available to get the information