community.vmware.vmware_vm_host_drs_rule (4.2.0) — module

Creates vm/host group in a given cluster

Authors: Karsten Kaj Jakobsen (@karstenjakobsen)

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

This module can be used to create VM-Host rules in a given cluster.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- name: "Create mandatory DRS Affinity rule for VM/Host"
  community.vmware.vmware_vm_host_drs_rule:
    hostname: "{{ vcenter_hostname }}"
    password: "{{ vcenter_password }}"
    username: "{{ vcenter_username }}"
    cluster_name: DC0_C0
    drs_rule_name: drs_rule_host_aff_0001
    host_group_name: DC0_C0_HOST_GR1
    vm_group_name: DC0_C0_VM_GR1
    mandatory: true
    enabled: true
    affinity_rule: true

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

state:
    choices:
    - present
    - absent
    default: present
    description:
    - If set to V(present) and the rule does not exist then the rule will be created.
    - If set to V(absent) and the rule exists then the rule will be deleted.
    type: str

enabled:
    default: false
    description:
    - If set to V(true), the DRS rule will be enabled.
    - Effective only if O(state=present).
    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

mandatory:
    default: false
    description:
    - If set to V(true), the DRS rule will be mandatory.
    - Effective only if O(state=present).
    type: bool

datacenter:
    aliases:
    - datacenter_name
    description:
    - Datacenter to search for given cluster. If not set, we use first cluster we encounter
      with O(cluster_name).
    required: false
    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:
    - Cluster to create VM-Host rule.
    required: true
    type: str

affinity_rule:
    default: true
    description:
    - If set to V(true), the DRS rule will be an Affinity rule.
    - If set to V(false), the DRS rule will be an Anti-Affinity rule.
    - Effective only if O(state=present).
    type: bool

drs_rule_name:
    description:
    - Name of rule to create or remove.
    required: true
    type: str

vm_group_name:
    description:
    - Name of VM group to use with rule.
    - Effective only if O(state=present).
    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

host_group_name:
    description:
    - Name of Host group to use with rule.
    - Effective only if O(state=present).
    type: str