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

388 lines
16 KiB
ReStructuredText

.. _community.vmware.vmware_vswitch_module:
*******************************
community.vmware.vmware_vswitch
*******************************
**Manage a VMware Standard Switch to an ESXi host.**
.. contents::
:local:
:depth: 1
Synopsis
--------
- This module can be used to add, remove and update a VMware Standard Switch to an ESXi host.
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="1">Parameter</th>
<th>Choices/<font color="blue">Defaults</font></th>
<th width="100%">Comments</th>
</tr>
<tr>
<td colspan="1">
<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>
</div>
</td>
<td>
</td>
<td>
<div>Manage the vSwitch using this ESXi host system.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: host</div>
</td>
</tr>
<tr>
<td colspan="1">
<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="1">
<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>MTU to configure on vSwitch.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>nics</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
/ <span style="color: purple">elements=string</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">[]</div>
</td>
<td>
<div>A list of vmnic names or vmnic name to attach to vSwitch.</div>
<div>Alias <code>nics</code> is added in version 2.4.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: nic_name</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>number_of_ports</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">128</div>
</td>
<td>
<div>Number of port to configure on vSwitch.</div>
</td>
</tr>
<tr>
<td colspan="1">
<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="1">
<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="1">
<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="1">
<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="1">
<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>absent</li>
<li><div style="color: blue"><b>present</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>Add or remove the switch.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>switch</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>vSwitch name to add.</div>
<div>Alias <code>switch</code> is added in version 2.4.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: switch_name</div>
</td>
</tr>
<tr>
<td colspan="1">
<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="1">
<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>
</table>
<br/>
Notes
-----
.. note::
- 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 a VMware vSwitch
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vswitch_name
nics: vmnic_name
mtu: 9000
delegate_to: localhost
- name: Add a VMware vSwitch without any physical NIC attached
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vswitch_0001
mtu: 9000
delegate_to: localhost
- name: Add a VMware vSwitch with multiple NICs
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
switch: vmware_vswitch_0004
nics:
- vmnic1
- vmnic2
mtu: 9000
delegate_to: localhost
- name: Add a VMware vSwitch to a specific host system
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: DC0_H0
switch_name: vswitch_001
nic_name: vmnic0
mtu: 9000
delegate_to: localhost
- name: Delete a VMware vSwitch in a specific host system
community.vmware.vmware_vswitch:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
esxi_hostname: DC0_H0
switch_name: vswitch_001
state: absent
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">string</span>
</div>
</td>
<td>always</td>
<td>
<div>information about performed operation</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;">vSwitch &#x27;vSwitch_1002&#x27; is created successfully</div>
</td>
</tr>
</table>
<br/><br/>
Status
------
Authors
~~~~~~~
- Joseph Callen (@jcpowermac)
- Russell Teague (@mtnbikenc)
- Abhijeet Kasurde (@Akasurde) <akasurde@redhat.com>