community.vmware.vmware_cluster_drs (4.2.0) — module

Manage Distributed Resource Scheduler (DRS) on VMware vSphere clusters

Authors: Joseph Callen (@jcpowermac), Abhijeet Kasurde (@Akasurde)

Install collection

Install with ansible-galaxy collection install community.vmware:==4.2.0


Add to requirements.yml

  collections:
    - name: community.vmware
      version: 4.2.0

Description

Manages DRS on VMware vSphere clusters.

All values and VMware object names are case sensitive.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable DRS
  community.vmware.vmware_cluster_drs:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: datacenter
    cluster_name: cluster
    enable: true
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable DRS and distribute a more even number of virtual machines across hosts for availability
  community.vmware.vmware_cluster_drs:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: datacenter
    cluster_name: cluster
    enable: true
    advanced_settings:
      'TryBalanceVmsPerHost': '1'
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Enable DRS and set default VM behavior to partially automated
  community.vmware.vmware_cluster_drs:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    datacenter_name: DC0
    cluster_name: "{{ cluster_name }}"
    enable: true
    drs_default_vm_behavior: partiallyAutomated
  delegate_to: localhost

Inputs

    
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

enable:
    default: true
    description:
    - Whether to enable DRS.
    type: bool

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

datacenter:
    aliases:
    - datacenter_name
    description:
    - The name of the datacenter.
    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 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

cluster_name:
    description:
    - The name of the cluster to be managed.
    required: true
    type: str

predictive_drs:
    default: false
    description:
    - In addition to real-time metrics, DRS will respond to forecasted metrics provided
      by vRealize Operations Manager.
    - You must also configure Predictive DRS in a version of vRealize Operations that
      supports this feature.
    type: bool
    version_added: 3.3.0
    version_added_collection: community.vmware

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

drs_vmotion_rate:
    choices:
    - 1
    - 2
    - 3
    - 4
    - 5
    default: 3
    description:
    - Threshold for generated ClusterRecommendations ranging from V(1) (lowest) to V(5)
      (highest).
    type: int

advanced_settings:
    default: {}
    description:
    - A dictionary of advanced DRS settings.
    type: dict

drs_default_vm_behavior:
    choices:
    - fullyAutomated
    - manual
    - partiallyAutomated
    default: fullyAutomated
    description:
    - Specifies the cluster-wide default DRS behavior for virtual machines.
    - If set to V(partiallyAutomated), vCenter generates recommendations for virtual machine
      migration and for the placement with a host, then automatically implements placement
      recommendations at power on.
    - If set to V(manual), then vCenter generates recommendations for virtual machine
      migration and for the placement with a host, but does not implement the recommendations
      automatically.
    - If set to V(fullyAutomated), then vCenter automates both the migration of virtual
      machines and their placement with a host at power on.
    type: str

drs_enable_vm_behavior_overrides:
    default: true
    description:
    - Whether DRS Behavior overrides for individual virtual machines are enabled.
    - If set to V(true), overrides O(drs_default_vm_behavior).
    type: bool