Files
offline_kubespray/collection/community/vmware/docs/community.vmware.vmware_vmkernel_module.rst
ByeonJungHun 360c6eef4a offline 작업
2024-02-19 16:02:29 +09:00

701 lines
31 KiB
ReStructuredText

.. _community.vmware.vmware_vmkernel_module:
********************************
community.vmware.vmware_vmkernel
********************************
**Manages a VMware VMkernel Adapter of an ESXi host.**
.. contents::
:local:
:depth: 1
Synopsis
--------
- This module can be used to manage the VMKernel adapters / VMKernel network interfaces of an ESXi host.
- The module assumes that the host is already configured with the Port Group in case of a vSphere Standard Switch (vSS).
- The module assumes that the host is already configured with the Distributed Port Group in case of a vSphere Distributed Switch (vDS).
- The module automatically migrates the VMKernel adapter from vSS to vDS or vice versa if present.
Requirements
------------
The below requirements are needed on the host that executes this module.
- python >= 2.6
- PyVmomi
Parameters
----------
.. raw:: html
<table border=0 cellpadding=0 class="documentation-table">
<tr>
<th colspan="2">Parameter</th>
<th>Choices/<font color="blue">Defaults</font></th>
<th width="100%">Comments</th>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>device</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>Search VMkernel adapter by device name.</div>
<div>The parameter is required only in case of <code>type</code> is set to <code>dhcp</code>.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>dvswitch_name</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>The name of the vSphere Distributed Switch (vDS) where to add the VMKernel interface.</div>
<div>Required parameter only if <code>state</code> is set to <code>present</code>.</div>
<div>Optional parameter from version 2.8 and onwards.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: dvswitch</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_ft</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Enable Fault Tolerance traffic on the VMKernel adapter.</div>
<div>This option is only allowed if the default TCP/IP stack is used.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_mgmt</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Enable Management traffic on the VMKernel adapter.</div>
<div>This option is only allowed if the default TCP/IP stack is used.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_provisioning</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Enable Provisioning traffic on the VMKernel adapter.</div>
<div>This option is only allowed if the default TCP/IP stack is used.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_replication</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Enable vSphere Replication traffic on the VMKernel adapter.</div>
<div>This option is only allowed if the default TCP/IP stack is used.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_replication_nfc</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Enable vSphere Replication NFC traffic on the VMKernel adapter.</div>
<div>This option is only allowed if the default TCP/IP stack is used.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_vmotion</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Enable vMotion traffic on the VMKernel adapter.</div>
<div>This option is only allowed if the default TCP/IP stack is used.</div>
<div>You cannot enable vMotion on an additional adapter if you already have an adapter with the vMotion TCP/IP stack configured.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>enable_vsan</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>no</b>&nbsp;&larr;</div></li>
<li>yes</li>
</ul>
</td>
<td>
<div>Enable VSAN traffic on the VMKernel adapter.</div>
<div>This option is only allowed if the default TCP/IP stack is used.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>esxi_hostname</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
/ <span style="color: red">required</span>
</div>
</td>
<td>
</td>
<td>
<div>Name of ESXi host to which VMKernel is to be managed.</div>
<div>From version 2.5 onwards, this parameter is required.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>hostname</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>The hostname or IP address of the vSphere vCenter or ESXi server.</div>
<div>If the value is not specified in the task, the value of environment variable <code>VMWARE_HOST</code> will be used instead.</div>
<div>Environment variable support added in Ansible 2.6.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>mtu</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">integer</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">1500</div>
</td>
<td>
<div>The MTU for the VMKernel interface.</div>
<div>The default value of 1500 is valid from version 2.5 and onwards.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>network</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">dictionary</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">{"tcpip_stack": "default", "type": "static"}</div>
</td>
<td>
<div>A dictionary of network details.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>default_gateway</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>Default gateway (Override default gateway for this adapter).</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>ip_address</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>Static IP address.</div>
<div>Required if <code>type</code> is set to <code>static</code>.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>subnet_mask</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>Static netmask required.</div>
<div>Required if <code>type</code> is set to <code>static</code>.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>tcpip_stack</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>default</b>&nbsp;&larr;</div></li>
<li>provisioning</li>
<li>vmotion</li>
<li>vxlan</li>
</ul>
</td>
<td>
<div>The TCP/IP stack for the VMKernel interface.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>type</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>static</b>&nbsp;&larr;</div></li>
<li>dhcp</li>
</ul>
</td>
<td>
<div>Type of IP assignment.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>password</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>The password of the vSphere vCenter or ESXi server.</div>
<div>If the value is not specified in the task, the value of environment variable <code>VMWARE_PASSWORD</code> will be used instead.</div>
<div>Environment variable support added in Ansible 2.6.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: pass, pwd</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>port</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">integer</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">443</div>
</td>
<td>
<div>The port number of the vSphere vCenter or ESXi server.</div>
<div>If the value is not specified in the task, the value of environment variable <code>VMWARE_PORT</code> will be used instead.</div>
<div>Environment variable support added in Ansible 2.6.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>portgroup_name</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
/ <span style="color: red">required</span>
</div>
</td>
<td>
</td>
<td>
<div>The name of the port group for the VMKernel interface.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: portgroup</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>proxy_host</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>Address of a proxy that will receive all HTTPS requests and relay them.</div>
<div>The format is a hostname or a IP.</div>
<div>If the value is not specified in the task, the value of environment variable <code>VMWARE_PROXY_HOST</code> will be used instead.</div>
<div>This feature depends on a version of pyvmomi greater than v6.7.1.2018.12</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>proxy_port</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">integer</span>
</div>
</td>
<td>
</td>
<td>
<div>Port of the HTTP proxy that will receive all HTTPS requests and relay them.</div>
<div>If the value is not specified in the task, the value of environment variable <code>VMWARE_PROXY_PORT</code> will be used instead.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>state</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li><div style="color: blue"><b>present</b>&nbsp;&larr;</div></li>
<li>absent</li>
</ul>
</td>
<td>
<div>If set to <code>present</code>, the VMKernel adapter will be created with the given specifications.</div>
<div>If set to <code>absent</code>, the VMKernel adapter will be removed.</div>
<div>If set to <code>present</code> and VMKernel adapter exists, the configurations will be updated.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>username</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>The username of the vSphere vCenter or ESXi server.</div>
<div>If the value is not specified in the task, the value of environment variable <code>VMWARE_USER</code> will be used instead.</div>
<div>Environment variable support added in Ansible 2.6.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: admin, user</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>validate_certs</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li>no</li>
<li><div style="color: blue"><b>yes</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>Allows connection when SSL certificates are not valid. Set to <code>false</code> when certificates are not trusted.</div>
<div>If the value is not specified in the task, the value of environment variable <code>VMWARE_VALIDATE_CERTS</code> will be used instead.</div>
<div>Environment variable support added in Ansible 2.6.</div>
<div>If set to <code>true</code>, please make sure Python &gt;= 2.7.9 is installed on the given machine.</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>vswitch_name</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
</td>
<td>
<div>The name of the vSwitch where to add the VMKernel interface.</div>
<div>Required parameter only if <code>state</code> is set to <code>present</code>.</div>
<div>Optional parameter from version 2.5 and onwards.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: vswitch</div>
</td>
</tr>
</table>
<br/>
Notes
-----
.. note::
- The option ``device`` need to be used with DHCP because otherwise it's not possible to check if a VMkernel device is already present
- You can only change from DHCP to static, and vSS to vDS, or vice versa, in one step, without creating a new device, with ``device`` specified.
- You can only create the VMKernel adapter on a vDS if authenticated to vCenter and not if authenticated to ESXi.
- Tested on vSphere 5.5 and 6.5
- All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
.. code-block:: yaml
- name: Add Management vmkernel port using static network type
community.vmware.vmware_vmkernel:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: '{{ esxi_hostname }}'
vswitch_name: vSwitch0
portgroup_name: PG_0001
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
community.vmware.vmware_vmkernel:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: '{{ esxi_hostname }}'
vswitch_name: vSwitch0
portgroup_name: PG_0002
state: present
network:
type: 'dhcp'
enable_mgmt: True
delegate_to: localhost
- name: Change IP allocation from static to dhcp
community.vmware.vmware_vmkernel:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: '{{ esxi_hostname }}'
vswitch_name: vSwitch0
portgroup_name: PG_0002
state: present
device: vmk1
network:
type: 'dhcp'
enable_mgmt: True
delegate_to: localhost
- name: Delete VMkernel port
community.vmware.vmware_vmkernel:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: '{{ esxi_hostname }}'
vswitch_name: vSwitch0
portgroup_name: PG_0002
state: absent
delegate_to: localhost
- name: Add Management vmkernel port to Distributed Switch
community.vmware.vmware_vmkernel:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
dvswitch_name: dvSwitch1
portgroup_name: dvPG_0001
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 vMotion vmkernel port with vMotion TCP/IP stack
community.vmware.vmware_vmkernel:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
dvswitch_name: dvSwitch1
portgroup_name: dvPG_0001
network:
type: 'static'
ip_address: 192.168.127.10
subnet_mask: 255.255.255.0
tcpip_stack: vmotion
state: present
delegate_to: localhost
Return Values
-------------
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
.. raw:: html
<table border=0 cellpadding=0 class="documentation-table">
<tr>
<th colspan="1">Key</th>
<th>Returned</th>
<th width="100%">Description</th>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="return-"></div>
<b>result</b>
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
<div style="font-size: small">
<span style="color: purple">dictionary</span>
</div>
</td>
<td>always</td>
<td>
<div>metadata about VMKernel name</div>
<br/>
<div style="font-size: smaller"><b>Sample:</b></div>
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">{&#x27;changed&#x27;: False, &#x27;msg&#x27;: &#x27;VMkernel Adapter already configured properly&#x27;, &#x27;device&#x27;: &#x27;vmk1&#x27;, &#x27;ipv4&#x27;: &#x27;static&#x27;, &#x27;ipv4_gw&#x27;: &#x27;No override&#x27;, &#x27;ipv4_ip&#x27;: &#x27;192.168.1.15&#x27;, &#x27;ipv4_sm&#x27;: &#x27;255.255.255.0&#x27;, &#x27;mtu&#x27;: 9000, &#x27;services&#x27;: &#x27;vMotion&#x27;, &#x27;switch&#x27;: &#x27;vDS&#x27;}</div>
</td>
</tr>
</table>
<br/><br/>
Status
------
Authors
~~~~~~~
- Joseph Callen (@jcpowermac)
- Russell Teague (@mtnbikenc)
- Abhijeet Kasurde (@Akasurde)
- Christian Kotte (@ckotte)