vmware.vmware_rest.vcenter_vm_hardware module – Manage the virtual hardware settings of a virtual machine.
Note
This module is part of the vmware.vmware_rest collection (version 5.0.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install vmware.vmware_rest.
To use it in a playbook, specify: vmware.vmware_rest.vcenter_vm_hardware.
New in vmware.vmware_rest 5.0.0
Synopsis
Update the virtual hardware configuration of a virtual machine, such as its virtual hardware (compatibility) version and the scheduled hardware upgrade policy.
Trigger an on-demand upgrade of the virtual hardware to a newer compatibility version.
The virtual machine is identified by its managed object identifier (MOID).
This module maps to the vCenter
/vcenter/vm/{vm}/hardwareREST API.
Parameters
Parameter |
Comments |
|---|---|
Timeout in seconds for the whole operation including connection establishment, request sending, and response. Default: |
|
The desired state of the resource. Use Use Only option Choices:
|
|
Scheduled upgrade policy that controls when the virtual hardware is automatically upgraded. If set to
If not set, the value is left unchanged. |
|
Target hardware version to be used on the next scheduled virtual hardware upgrade. If specified, this must be a newer virtual hardware version than the virtual machine’s current hardware version.
If |
|
The hostname or IP address of the vSphere vCenter. If the value is not specified in the task, the value of environment variable |
|
The vSphere vCenter password. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter. If the value is not specified in the task, the value of environment variable |
|
Optional path to a log file for HTTP REST interaction. If the value is not specified in the task, the value of environment variable |
|
The vSphere vCenter username. If the value is not specified in the task, the value of environment variable |
|
Allows connection when SSL certificates are not valid. Set to If the value is not specified in the task, the value of environment variable Choices:
|
|
Target virtual hardware (compatibility) version to upgrade the virtual machine to. Only used when
If not set, defaults to the most recent virtual hardware version supported by the server. |
|
Identifier of the virtual machine whose hardware is being managed. Must be the managed object identifier (MOID) of an existing |
Notes
Note
Generated from vSphere API spec 9.1.0.
Compatible with vSphere API 7.0.3.
Compatible with vSphere API 8.0.2.
Examples
- name: Schedule a hardware upgrade after a clean guest shutdown
vmware.vmware_rest.vcenter_vm_hardware:
vm: vm-1001
upgrade_policy: AFTER_CLEAN_SHUTDOWN
upgrade_version: VMX_21
state: present
- name: Disable scheduled hardware upgrades
vmware.vmware_rest.vcenter_vm_hardware:
vm: vm-1001
upgrade_policy: NEVER
state: present
- name: Upgrade the virtual hardware to the latest version supported by the host
vmware.vmware_rest.vcenter_vm_hardware:
vm: vm-1001
state: upgrade
- name: Upgrade the virtual hardware to a specific version
vmware.vmware_rest.vcenter_vm_hardware:
vm: vm-1001
version: VMX_22
state: upgrade
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
MOID of the managed virtual machine. Returned: When state is present, or when a resource is deleted, or when state is set to a supported action. Sample: |
|
The raw API response body from the vCenter operation. Returned: On success Sample: |