vmware_vmkernel – Manage a VMware VMkernel Interface aka. Virtual NICs of host system.
vmware_vmkernel – Manage a VMware VMkernel Interface aka. Virtual NICs of host system.
New in version 2.0.
Synopsis
- This module can be used to manage the VMWare VMKernel interface (also known as Virtual NICs) of host system.
- This module assumes that the host is already configured with Portgroup and vSwitch.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.6
- PyVmomi
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
enable_ft boolean |
|
Enable the VMKernel interface for Fault Tolerance traffic. |
enable_mgmt boolean |
|
Enable the VMKernel interface for Management traffic. |
enable_vmotion boolean |
|
Enable the VMKernel interface for vMotion traffic. |
enable_vsan boolean |
|
Enable the VMKernel interface for VSAN traffic. |
esxi_hostname - / required added in 2.5 |
Name of ESXi host to which VMKernel is to be managed. From version 2.5 onwards, this parameter is required. | |
hostname string |
The hostname or IP address of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in version 2.6. | |
ip_address - |
The IP Address for the VMKernel interface. Use Deprecated option, will be removed in version 2.9. | |
mtu - |
Default: 1500 |
The MTU for the VMKernel interface. The default value of 1500 is valid from version 2.5 and onwards. |
network - added in 2.5 |
A dictionary of network details. Following parameter is required: - Following parameters are required in case of - - | |
password string |
The password of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in version 2.6.
| |
port integer added in 2.5 |
Default: 443 |
The port number of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in version 2.6. |
portgroup_name - / required |
The name of the port group for the VMKernel interface. | |
state - added in 2.5 |
|
If set to If set to If set to |
subnet_mask - |
The Subnet Mask for the VMKernel interface. Use Deprecated option, will be removed in version 2.9. | |
username string |
The username of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Environment variable support added in version 2.6.
| |
validate_certs boolean |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Environment variable support added in version 2.6. If set to |
vlan_id - added in 2.0 |
The VLAN ID for the VMKernel interface. Required parameter only if Optional parameter from version 2.5 and onwards. | |
vswitch_name - |
The name of the vSwitch where to add the VMKernel interface. Required parameter only if Optional parameter from version 2.5 and onwards. |
Notes
Note
- Tested on vSphere 5.5, 6.5
Examples
- name: Add Management vmkernel port using static network type
vmware_vmkernel:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vswitch_name: vSwitch0
portgroup_name: PG_0001
vlan_id: '{{ vlan_id }}'
network:
type: 'static'
ip_address: 192.168.127.10
subnet_mask: 255.255.255.0
state: present
enable_mgmt: True
delegate_to: localhost
- name: Add Management vmkernel port using DHCP network type
vmware_vmkernel:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vswitch_name: vSwitch0
portgroup_name: PG_0002
vlan_id: '{{ vlan_id }}'
state: present
network:
type: 'dhcp'
enable_mgmt: True
delegate_to: localhost
- name: Delete VMkernel port using DHCP network type
vmware_vmkernel:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
vswitch_name: vSwitch0
portgroup_name: PG_0002
vlan_id: '{{ vlan_id }}'
state: absent
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
result dictionary |
always |
metadata about VMKernel name
Sample: {'results': 'vmk1'} |
Status
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors
- Joseph Callen (@jcpowermac)
- Russell Teague (@mtnbikenc)
- Abhijeet Kasurde (@Akasurde) <[email protected]>
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.7/modules/vmware_vmkernel_module.html