ansible.builtin.vmware_vm_host_drs_rule (v2.9.24) — module

Creates vm/host group in a given cluster

| "added in version" 2.8 of ansible.builtin"

Authors: Karsten Kaj Jakobsen (@karstenjakobsen)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.24

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- name: "Create mandatory DRS Affinity rule for VM/Host"
  vmware_vm_host_drs_rule:
    hostname: "{{ vcenter_hostname }}"
    password: "{{ vcenter_password }}"
    username: "{{ vcenter_username }}"
    validate_certs: False
    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 C(VMWARE_PORT)
      will be used instead.
    - Environment variable support added in Ansible 2.6.
    type: int

state:
    choices:
    - present
    - absent
    default: present
    description:
    - If set to C(present) and the rule doesn't exists then the rule will be created.
    - If set to C(absent) and the rule exists then the rule will be deleted.
    required: true
    type: str

enabled:
    default: false
    description:
    - If set to C(True), the DRS rule will be enabled.
    - Effective only if C(state) is set to C(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 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

mandatory:
    default: false
    description:
    - If set to C(True), the DRS rule will be mandatory.
    - Effective only if C(state) is set to C(present).
    type: bool

datacenter:
    aliases:
    - datacenter_name
    description:
    - Datacenter to search for given cluster. If not set, we use first cluster we encounter
      with C(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 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

cluster_name:
    description:
    - Cluster to create VM-Host rule.
    required: true
    type: str

affinity_rule:
    default: true
    description:
    - If set to C(True), the DRS rule will be an Affinity rule.
    - If set to C(False), the DRS rule will be an Anti-Affinity rule.
    - Effective only if C(state) is set to C(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 C(state) is set to C(present).
    required: true
    type: str

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

host_group_name:
    description:
    - Name of Host group to use with rule.
    - Effective only if C(state) is set to C(present).
    required: true
    type: str