# how to deploy vm in DVS switch through ansible script

**URL:** <https://forum.ansible.com/t/how-to-deploy-vm-in-dvs-switch-through-ansible-script/27819>\
**Category:** Ansible Project\
**Created:** [June 19, 2018, 6:44am UTC](https://forum.ansible.com/t/how-to-deploy-vm-in-dvs-switch-through-ansible-script/27819 "2018-06-19T06:44:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Umesh\_Gowda](https://avatars.discourse-cdn.com/v4/letter/u/8edcca/32.png) [@Umesh\_Gowda](https://forum.ansible.com/u/Umesh_Gowda)\
**Post date:** [June 19, 2018, 6:44am UTC](https://forum.ansible.com/t/how-to-deploy-vm-in-dvs-switch-through-ansible-script/27819/1 "2018-06-19T06:44:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sebastien\_Desbois](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastien\_Desbois](https://forum.ansible.com/u/Sebastien_Desbois)\
**Post date:** [June 22, 2018, 9:37am UTC](https://forum.ansible.com/t/how-to-deploy-vm-in-dvs-switch-through-ansible-script/27819/2 "2018-06-22T09:37:53Z")

</div>

Which module are you using ?  
Because your syntaxe looks like a mix of vmware\_guest and vsphere\_guest

---

<div class="post-metadata">

**Author:** ![Umesh\_Gowda](https://avatars.discourse-cdn.com/v4/letter/u/8edcca/32.png) [@Umesh\_Gowda](https://forum.ansible.com/u/Umesh_Gowda)\
**Post date:** [June 22, 2018, 11:29am UTC](https://forum.ansible.com/t/how-to-deploy-vm-in-dvs-switch-through-ansible-script/27819/3 "2018-06-22T11:29:46Z")

</div>

vmware\_guest

---

<div class="post-metadata">

**Author:** ![Sebastien\_Desbois](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastien\_Desbois](https://forum.ansible.com/u/Sebastien_Desbois)\
**Post date:** [June 25, 2018, 11:55am UTC](https://forum.ansible.com/t/how-to-deploy-vm-in-dvs-switch-through-ansible-script/27819/4 "2018-06-25T11:55:33Z")

</div>

If I refer to the vmware\_guest doc ([https://docs.ansible.com/ansible/latest/modules/vmware\_guest\_module.html](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](https://github.com/ansible/ansible/issues/41781)

---

<div class="post-metadata">

**Author:** ![Umesh\_Gowda](https://avatars.discourse-cdn.com/v4/letter/u/8edcca/32.png) [@Umesh\_Gowda](https://forum.ansible.com/u/Umesh_Gowda)\
**Post date:** [June 25, 2018, 3:49pm UTC](https://forum.ansible.com/t/how-to-deploy-vm-in-dvs-switch-through-ansible-script/27819/5 "2018-06-25T15:49:36Z")

</div>

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
