vmware_vmkernel - Manage a VMware VMkernel Interface aka. Virtual NICs of host system.

New in version 2.0.

Synopsis

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • PyVmomi

Parameters

Parameter Choices/Defaults Comments
enable_ft
bool
    Choices:
  • no
  • yes
Enable the VMKernel interface for Fault Tolerance traffic.
enable_mgmt
bool
    Choices:
  • no
  • yes
Enable the VMKernel interface for Management traffic.
enable_vmotion
bool
    Choices:
  • no
  • yes
Enable the VMKernel interface for vMotion traffic.
enable_vsan
bool
    Choices:
  • no
  • yes
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
str
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 VMWARE_HOST will be used instead.
Environment variable supported added in version 2.6.
ip_address
The IP Address for the VMKernel interface.
Use network parameter with ip_address instead.
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:
- type (string): Type of IP assignment (either dhcp or static).
Following parameters are required in case of type is set to static
- ip_address (string): Static IP address (implies type: static).
- subnet_mask (string): Static netmask required for ip.
password
str
The password of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.
Environment variable supported added in version 2.6.

aliases: pass, pwd
port
int

(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 VMWARE_PORT will be used instead.
Environment variable supported added in version 2.6.
portgroup_name
required
The name of the port group for the VMKernel interface.
state
(added in 2.5)
    Choices:
  • present ←
  • absent
If set to present, VMKernel is created with the given specifications.
If set to absent, VMKernel is removed from the given configurations.
If set to present and VMKernel exists then VMKernel configurations are updated.
subnet_mask
The Subnet Mask for the VMKernel interface.
Use network parameter with subnet_mask instead.
Deprecated option, will be removed in version 2.9.
username
str
The username of the vSphere vCenter or ESXi server.
If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.
Environment variable supported added in version 2.6.

aliases: admin, user
validate_certs
bool
    Choices:
  • no
  • yes ←
Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.
If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.
Environment variable supported added in version 2.6.
If set to yes, please make sure Python >= 2.7.9 is installed on the given machine.
vlan_id
(added in 2.0)
The VLAN ID for the VMKernel interface.
Required parameter only if state is set to present.
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 state is set to present.
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
dict
always
metadata about VMKernel name

Sample:
{'results': 'vmk1'}


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Joseph Callen (@jcpowermac)
  • Russell Teague (@mtnbikenc)
  • Abhijeet Kasurde (@Akasurde) <akasurde@redhat.com>

Hint

If you notice any issues in this documentation you can edit this document to improve it.