community / community.vmware / 1.18.2 / module / vmware_drs_group_manager Manage VMs and Hosts in DRS group. | "added in version" 1.7.0 of community.vmware" Authors: Abhijeet Kasurde (@Akasurde)community.vmware.vmware_drs_group_manager (1.18.2) — module
Install with ansible-galaxy collection install community.vmware:==1.18.2
collections: - name: community.vmware version: 1.18.2
The module can be used to add VMs / Hosts to or remove them from a DRS group.
--- - name: Add VMs in an existing DRS VM group delegate_to: localhost community.vmware.vmware_drs_group_manager: hostname: "{{ vcenter_hostname }}" password: "{{ vcenter_password }}" username: "{{ vcenter_username }}" cluster: DC0_C0 datacenter: DC0 group_name: TEST_VM_01 vms: - DC0_C0_RP0_VM0 - DC0_C0_RP0_VM1 state: present
- name: Add Hosts in an existing DRS Host group delegate_to: localhost community.vmware.vmware_drs_group_manager: hostname: "{{ vcenter_hostname }}" password: "{{ vcenter_password }}" username: "{{ vcenter_username }}" cluster: DC0_C0 datacenter: DC0 group_name: TEST_HOST_01 hosts: - DC0_C0_H0 - DC0_C0_H1 - DC0_C0_H2 state: present
- name: Remove VM from an existing DRS VM group delegate_to: localhost community.vmware.vmware_drs_group_manager: hostname: "{{ vcenter_hostname }}" password: "{{ vcenter_password }}" username: "{{ vcenter_username }}" cluster: DC0_C0 datacenter: DC0 group_name: TEST_VM_01 vms: - DC0_C0_RP0_VM0 state: absent
- name: Remove host from an existing DRS Host group delegate_to: localhost community.vmware.vmware_drs_group_manager: hostname: "{{ vcenter_hostname }}" password: "{{ vcenter_password }}" username: "{{ vcenter_username }}" cluster: DC0_C0 datacenter: DC0 group_name: TEST_HOST_01 hosts: - DC0_C0_H0 state: absent
vms: description: - A List of vms to add / remove in the group. - Required only if I(hosts) is not set. elements: str required: false type: list 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 C(VMWARE_PORT) will be used instead. - Environment variable support added in Ansible 2.6. type: int hosts: description: - A List of hosts to add / remove in the group. - Required only if I(vms) is not set. elements: str required: false type: list state: choices: - present - absent default: present description: - If set to C(present), VMs/hosts will be added to the given DRS group. - If set to C(absent), VMs/hosts will be removed from the given DRS group. type: str cluster: aliases: - cluster_name description: - Cluster to which DRS group associated with. required: true 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 C(VMWARE_HOST) will be used instead. - Environment variable support added in Ansible 2.6. 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 C(VMWARE_PASSWORD) will be used instead. - Environment variable support added in Ansible 2.6. 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 C(VMWARE_USER) will be used instead. - Environment variable support added in Ansible 2.6. type: str datacenter: aliases: - datacenter_name description: - Name of the datacenter. required: false type: str group_name: description: - The name of the group to manage. required: true 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 C(VMWARE_PROXY_HOST) will be used instead. - This feature depends on a version of pyvmomi greater than v6.7.1.2018.12 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 C(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 C(false) when certificates are not trusted. - If the value is not specified in the task, the value of environment variable C(VMWARE_VALIDATE_CERTS) will be used instead. - Environment variable support added in Ansible 2.6. - If set to C(true), please make sure Python >= 2.7.9 is installed on the given machine. type: bool
drs_group_member_info: description: Metadata about DRS group returned: always sample: Asia-Cluster1: - group_name: vm_group_002 type: vm vms: - dev-1 type: dict msg: description: Info message returned: always sample: Updated host group TEST_HOST_01 successfully type: str