vmware.vmware_rest.vcenter_vm_storage_policy_compliance module – Check the storage policy compliance 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_storage_policy_compliance.
New in vmware.vmware_rest 5.0.0
Synopsis
Run an on-demand storage policy compliance check for a virtual machine.
The check compares the storage policies assigned to the virtual machine’s home directory and virtual disks against the actual storage on which they reside.
The compliance results are returned in the response; use vmware.vmware_rest.vcenter_vm_storage_policy_compliance_info to read the last known compliance status without triggering a new check.
Parameters
Parameter |
Comments |
|---|---|
The MOIDs (managed object identifiers) of the virtual machine’s virtual disks to check for compliance. Each identifier must reference a If omitted, null, or empty, the compliance check is invoked on all disks associated with the virtual machine. This property was added in vSphere API 6.7. |
|
Timeout in seconds for the whole operation including connection establishment, request sending, and response. Default: |
|
The desired state of the resource. Use This module only supports the Choices:
|
|
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:
|
|
The identifier of the virtual machine to check for compliance. Must be the MOID (managed object identifier) of a |
|
Whether to include the virtual machine’s home directory in the compliance check. Set to This property was added in vSphere API 6.7. Choices:
|
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: Look up the VM called test_vm1 in the inventory
register: search_result
vmware.vmware_rest.vcenter_vm_info:
filter_names:
- test_vm1
- name: Check storage policy compliance for the whole VM
vmware.vmware_rest.vcenter_vm_storage_policy_compliance:
vm: '{{ search_result.value[0].vm }}'
vm_home: true
state: check
- name: Check compliance for specific disks only
vmware.vmware_rest.vcenter_vm_storage_policy_compliance:
vm: '{{ search_result.value[0].vm }}'
vm_home: false
disks:
- '2000'
- '2001'
state: check
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
|---|---|
MOID of the virtual machine that was checked. Returned: When state is set to a supported action. Sample: |
|
The raw API response body containing the storage policy compliance results. Returned: On success Sample: |