community / community.vmware / 4.2.0 / module / vmware_guest_storage_policy Set VM Home and disk(s) storage policy profiles. Authors: Tyler Gates (@tgates81)community.vmware.vmware_guest_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
This module can be used to enforce storage policy profiles per disk and/or VM Home on a virtual machine.
- name: Enforce storepol1 policy for disk 0 and 1 on SCSI controller 0 using UUID community.vmware.vmware_guest_storage_policy: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" validate_certs: false uuid: cefd316c-fc19-45f3-a539-2cd03427a78d disk: - unit_number: 0 controller_number: 0 policy: storepol1 - unit_number: 1 controller_number: 0 policy: storepol1 delegate_to: localhost register: policy_status
- name: Enforce storepol1 policy for VM Home using name community.vmware.vmware_guest_storage_policy: hostname: "{{ vcenter_hostname }}" username: "{{ vcenter_username }}" password: "{{ vcenter_password }}" validate_certs: false name: hostname1 vm_home: storepol1 delegate_to: localhost
disk: description: - A list of disks with storage profile policies to enforce. - All values and parameters are case sensitive. - At least one of O(disk) and O(vm_home) are required parameters. elements: dict required: false suboptions: controller_number: default: 0 description: - SCSI controller number. - Valid values range from 0 to 3. type: int policy: description: - Name of the storage profile policy to enforce for the disk. required: true type: str unit_number: description: - Disk Unit Number. - Valid values range from 0 to 15. required: true type: int type: list moid: description: - Managed Object ID of the instance to manage if known, this is a unique identifier only within a single vCenter instance. - One of O(name), O(uuid), or O(moid) are required to define the virtual machine. required: false type: str name: description: - Name of the virtual machine. - One of O(name), O(uuid), or O(moid) are required to define the virtual machine. required: false 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 uuid: description: - UUID of the virtual machine. - One of O(name), O(uuid), or O(moid) are required to define the virtual machine. required: false type: str folder: description: - Destination folder, absolute or relative path to find an existing guest. - This is a required parameter if multiple VMs are found with same name. - The folder should include the datacenter. ESX's datacenter is ha-datacenter. - 'Examples:' - ' folder: /ha-datacenter/vm' - ' folder: ha-datacenter/vm' - ' folder: /datacenter1/vm' - ' folder: datacenter1/vm' - ' folder: /datacenter1/vm/folder1' - ' folder: datacenter1/vm/folder1' - ' folder: /folder1/datacenter1/vm' - ' folder: folder1/datacenter1/vm' - ' folder: /folder1/datacenter1/vm/folder2' required: false type: str vm_home: description: - A storage profile policy to set on VM Home. - All values and parameters are case sensitive. - At least one of O(disk) or O(vm_home) are required parameters. required: false 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 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 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
changed_policies: description: Dictionary containing the changed policies of disk (list of dictionaries) and vm_home. returned: always sample: disk: - policy: storepol1 unit_number: 0 vm_home: storepol1 type: dict msg: description: Informational message on the job result. returned: always sample: Policies successfully set. type: str