vpshere: how to change port group for 2nd NIC on VM via ansible

30 views
Skip to first unread message

Ansible Madness

unread,
Sep 24, 2018, 6:51:32 AM9/24/18
to Ansible Project

Scenario: VM on ESXi with 2 NICS
Network_adapter1: Fixed port group/VLAN
Network_adapter2: Variable port group/VLAN

So all i am trying to achieve with ansible is to modify the port group/VLAN of Network_adapter2, is this even possible?

I looked at https://docs.ansible.com/ansible/latest/modules/vmware_guest_module.html#vmware-guest-module (networks section), but don't really think this will achieve what i require

In vsphere this can be achieve din the powershell with something like 'set-networkadapter -Portgroup "XXX"' for the interface in question

Many thanks for anyone with experience here.

Cheers
Rod

Ansible Madness

unread,
Sep 24, 2018, 7:10:03 AM9/24/18
to Ansible Project
So seems the vmware_guest module is in fact ok - however there appears to be no way to specify the NIC but have to rely on the order of the list and perform the port group change to each Adapter

example:

   -  vmware_guest:
         .
         .
         networks:
         - name: management
         - name: changeme

Good enough for my needs

Cheers

JerryB

unread,
Apr 17, 2020, 8:32:19 AM4/17/20
to Ansible Project
Reply all
Reply to author
Forward
0 new messages