community / community.vmware / 4.2.0 / module / vmware_vm_storage_policy Create vSphere storage policies Authors: Dustin Scott (@scottd018)community.vmware.vmware_vm_storage_policy (4.2.0) — module
Install with ansible-galaxy collection install community.vmware:==4.2.0
collections: - name: community.vmware version: 4.2.0
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.
- 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
name: description: - Name of the storage policy to create, update, or delete. required: true type: str port: default: 443 description: - The port number of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT) will be used instead. type: int state: choices: - absent - present default: present description: - State of storage policy. - If set to V(present), the storage policy is created. - If set to V(absent), the storage policy is deleted. type: str hostname: description: - 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 E(VMWARE_HOST) will be used instead. type: str password: aliases: - pass - pwd description: - The password of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD) will be used instead. type: str tag_name: description: - Name of the pre-existing tag to assign to the storage policy. - This parameter is ignored when O(state=absent). - This parameter is required when O(state=present). required: false type: str username: aliases: - admin - user description: - The username of the vSphere vCenter or ESXi server. - If the value is not specified in the task, the value of environment variable E(VMWARE_USER) will be used instead. type: str proxy_host: description: - 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 E(VMWARE_PROXY_HOST) will be used instead. required: false type: str proxy_port: description: - 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 E(VMWARE_PROXY_PORT) will be used instead. required: false type: int description: description: - Description of the storage policy to create or update. - This parameter is ignored when O(state=absent). required: false type: str tag_affinity: default: true description: - If set to V(true), the storage policy enforces that virtual machines require the existence of a tag for datastore placement. - If set to V(false), the storage policy enforces that virtual machines require the absence of a tag for datastore placement. - This parameter is ignored when O(state=absent). required: false type: bool tag_category: description: - Name of the pre-existing tag category to assign to the storage policy. - This parameter is ignored when O(state=absent). - This parameter is required when O(state=present). required: false type: str validate_certs: default: true description: - Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS) will be used instead. type: bool
vmware_vm_storage_policy: description: dictionary of information for the storage policy returned: success sample: vmware_vm_storage_policy: description: Storage policy for gold-tier storage id: aa6d5a82-1c88-45da-85d3-3d74b91a5bad name: gold type: dict