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 }}"