I want to disconnect vm’s nic. But i cant do it with modules in vmware.vmware collection. Because i dont know network parameter of that vm. How can i get that parameter , which module in vmware.vmware collection? .
vmware.vmware.vm:
moid: xxxx
network_adapters:
- network: "XXXX"
connected: false
Hi there, I am solved this problem just now.
There is a module “vmware.vmware.vm_portgroup_info”
I used this module just like above
Little explanation:
vm_names can be a list too.
In the debug section i used …inventory_hostname[0]. , because there can be multiple nic in that vm, i want to get only first nic.
- name: gather network info about vm
vm_portgroup_info:
vm_names: "{{ inventory_hostname }}"
register: netInfo
- debug:
msg: " {{ netInfo.vm_portgroup_info.[inventory_hostname][0].portgroup_name }}"
1 Like
system
(system)
Closed
March 24, 2026, 11:17am
3
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.