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

416 lines
18 KiB
ReStructuredText

.. _community.vmware.vmware_vmotion_module:
*******************************
community.vmware.vmware_vmotion
*******************************
**Move a virtual machine using vMotion, and/or its vmdks using storage vMotion.**
.. contents::
:local:
:depth: 1
Synopsis
--------
- Using VMware vCenter, move a virtual machine using vMotion to a different host, and/or its vmdks to another datastore using storage vMotion.
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>destination_datacenter</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
<div style="font-style: italic; font-size: small; color: darkgreen">added in 1.11.0</div>
</td>
<td>
</td>
<td>
<div>Name of the destination datacenter the datastore is located on.</div>
<div>Optional, required only when datastores are shared across datacenters.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>destination_datastore</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>Name of the destination datastore the virtual machine&#x27;s vmdk should be moved on.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: datastore</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>destination_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>Name of the destination host the virtual machine should be running on.</div>
<div>Version 2.6 onwards, this parameter is not a required parameter, unlike the previous versions.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: destination</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>destination_resourcepool</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>Name of the destination resource pool where the virtual machine should be running.</div>
<div>Resource pool is required if vmotion is done between hosts which are part of different clusters or datacenters.</div>
<div>if not passed, resource_pool object will be retrived from host_obj parent.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: resource_pool</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>moid</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>Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance.</div>
<div>This is required if <code>vm_name</code> or <code>vm_uuid</code> is not supplied.</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>use_instance_uuid</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>Whether to use the VMware instance UUID rather than the BIOS UUID.</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>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>vm_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>Name of the VM to perform a vMotion on.</div>
<div>This is required parameter, if <code>vm_uuid</code> is not set.</div>
<div>Version 2.6 onwards, this parameter is not a required parameter, unlike the previous versions.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: vm</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>vm_uuid</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>UUID of the virtual machine to perform a vMotion operation on.</div>
<div>This is a required parameter, if <code>vm_name</code> or <code>moid</code> is not set.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: uuid</div>
</td>
</tr>
</table>
<br/>
Notes
-----
.. note::
- Tested on vSphere 6.0
- All modules requires API write access and hence is not supported on a free ESXi license.
Examples
--------
.. code-block:: yaml
- name: Perform vMotion of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: 'vm_name_as_per_vcenter'
destination_host: 'destination_host_as_per_vcenter'
delegate_to: localhost
- name: Perform vMotion of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
moid: vm-42
destination_host: 'destination_host_as_per_vcenter'
delegate_to: localhost
- name: Perform vMotion of virtual machine to resource_pool
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
moid: vm-42
destination_host: 'destination_host_as_per_vcenter'
destination_resourcepool: 'destination_resourcepool_as_per_vcenter'
delegate_to: localhost
- name: Perform storage vMotion of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: 'vm_name_as_per_vcenter'
destination_datastore: 'destination_datastore_as_per_vcenter'
delegate_to: localhost
- name: Perform storage vMotion and host vMotion of virtual machine
community.vmware.vmware_vmotion:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
vm_name: 'vm_name_as_per_vcenter'
destination_host: 'destination_host_as_per_vcenter'
destination_datastore: 'destination_datastore_as_per_vcenter'
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>running_host</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>changed or success</td>
<td>
<div>List the host the virtual machine is registered to</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;">host1.example.com</div>
</td>
</tr>
</table>
<br/><br/>
Status
------
Authors
~~~~~~~
- Bede Carroll (@bedecarroll)
- Olivier Boukili (@oboukili)