community.vmware.vmware_vm_storage_policy module – Create vSphere storage policies
Note
This module is part of the community.vmware collection (version 4.8.1).
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 community.vmware
.
To use it in a playbook, specify: community.vmware.vmware_vm_storage_policy
.
Synopsis
A vSphere storage policy defines metadata that describes storage requirements for virtual machines and storage capabilities of storage providers.
Currently, only tag-based storage policy creation is supported.
Parameters
Parameter |
Comments |
---|---|
Description of the storage policy to create or update. This parameter is ignored when |
|
The hostname or IP address of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable |
|
Name of the storage policy to create, update, or delete. |
|
The password of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable |
|
The port number of the vSphere vCenter or ESXi server. If the value is not specified in the task, the value of environment variable Default: |
|
Address of a proxy that will receive all HTTPS requests and relay them. The format is a hostname or a IP. If the value is not specified in the task, the value of environment variable |
|
Port of the HTTP proxy that will receive all HTTPS requests and relay them. If the value is not specified in the task, the value of environment variable |
|
State of storage policy. If set to If set to Choices:
|
|
If set to If set to This parameter is ignored when Choices:
|
|
Name of the pre-existing tag category to assign to the storage policy. This parameter is ignored when This parameter is required when |
|
Name of the pre-existing tag to assign to the storage policy. This parameter is ignored when This parameter is required when |
|
The username of the vSphere vCenter or ESXi server. 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:
|
Notes
Note
All modules requires API write access and hence is not supported on a free ESXi license.
All variables and VMware object names are case sensitive.
Examples
- name: Create or update a vSphere tag-based storage policy
community.vmware.vmware_vm_storage_policy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: "vSphere storage policy"
description: "vSphere storage performance policy"
tag_category: "performance_tier"
tag_name: "gold"
tag_affinity: true
state: "present"
delegate_to: localhost
- name: Remove a vSphere tag-based storage policy
community.vmware.vmware_vm_storage_policy:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
name: "vSphere storage policy"
state: "absent"
delegate_to: localhost
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
dictionary of information for the storage policy Returned: success Sample: |