community.vmware.vmware_guest_network – Manage network adapters of specified virtual machine in given vCenter infrastructure¶
Note
This plugin is part of the community.vmware collection (version 1.7.0).
To install it use: ansible-galaxy collection install community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_guest_network
.
New in version 1.0.0: of community.vmware
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.7
PyVmomi
Parameters¶
Notes¶
Note
Tested on vSphere 6.0, 6.5 and 6.7
For backwards compatibility network_data is returned when using the gather_network_info and networks parameters
Examples¶
- name: change network for 00:50:56:11:22:33 on vm01.domain.fake
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: vm01.domain.fake
mac_address: 00:50:56:11:22:33
network_name: admin-network
state: present
- name: add a nic on network with vlan id 2001 for 422d000d-2000-ffff-0000-b00000000000
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
uuid: 422d000d-2000-ffff-0000-b00000000000
vlan_id: 2001
- name: remove nic with mac 00:50:56:11:22:33 from vm01.domain.fake
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
mac_address: 00:50:56:11:22:33
name: vm01.domain.fake
state: absent
- name: add multiple nics to vm01.domain.fake
community.vmware.vmware_guest_network:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ datacenter_name }}"
name: vm01.domain.fake
state: present
vlan_id: "{{ item.vlan_id | default(omit) }}"
network_name: "{{ item.network_name | default(omit) }}"
connected: "{{ item.connected | default(omit) }}"
loop:
- vlan_id: 2000
connected: false
- network_name: guest-net
connected: true
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Diane Wang (@Tomorrow9) <dianew@vmware.com>