Creating VSS (Virtual Standard Switch) via Ansible

Creating Virtual Standard Switch via Ansible












To create this playbook I use two modules vmware_vswitch  and  vmware_portgroup.


Ansible documentation.

vmware_vswitch >>

vmware_portgroup >>

download playbook >> VSScreator.yml

download secrets file >> secrets.vml


1.Before  run this playbook I need to install vmware collection by run “ansible-galaxy collection install community.vmware


2.  Create or download  secrets.vml file with passwords and some vars.



3. Playbook  will find all esxi host in your vCenter and add vswich and create port group on each of them.

Playbook will set up some specific settings like (MTU , promiscuous_mode , mac_changes , forged_transmits and traffic_shaping )


4. To run playbook use: ansible-playbook ansible/VSScreator.yml command


5. Let’s check result on vCenter level.

VSS was created and associate with port group  and vmnic7


Security Settings


Traffic shaping settings





Please Subscribe



Leave a Reply

Your email address will not be published. Required fields are marked *