vmware.vmware.cluster_info module – Gathers information about one or more clusters

Note

This module is part of the vmware.vmware collection (version 1.7.1).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install vmware.vmware.

To use it in a playbook, specify: vmware.vmware.cluster_info.

Synopsis

  • Gathers information about one or more clusters. You can search for clusters based on the cluster name, datacenter name, or a combination of the two.

Parameters

Parameter

Comments

cluster

aliases: cluster_name, name

string

The name of the cluster on which to gather info.

At least one of datacenter or cluster is required.

datacenter

aliases: datacenter_name

string

The name of the datacenter.

At least one of datacenter or cluster is required.

gather_tags

boolean

If true, gather any tags attached to the cluster(s)

This has no affect if the schema is set to vsphere. In that case, add ‘tag’ to properties or leave properties unset.

Choices:

  • false ← (default)

  • true

hostname

string

The hostname or IP address of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead.

password

aliases: pass, pwd

string

The password of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.

port

integer

The port number of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.

Default: 443

properties

list / elements=string

If the schema is ‘vsphere’, gather these specific properties only

proxy_host

string

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 VMWARE_PROXY_HOST will be used instead.

proxy_port

integer

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 VMWARE_PROXY_PORT will be used instead.

schema

string

Specify the output schema desired.

The summary output schema is the legacy output from the module.

The vsphere output schema is the vSphere API class definition.

Choices:

  • "summary" ← (default)

  • "vsphere"

username

aliases: admin, user

string

The username of the vSphere vCenter server.

If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.

validate_certs

boolean

Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted.

If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

Notes

Note

  • All modules require API write access and hence is not supported on a free ESXi license.

Examples

- name: Gather Cluster Information
  vmware.vmware.cluster_info:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: datacenter
    cluster_name: my_cluster
  register: _out

- name: Gather Information About All Clusters In a Datacenter
  vmware.vmware.cluster_info:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    datacenter_name: datacenter
  register: _out

- name: Gather Specific Properties About a Cluster
  vmware.vmware.cluster_info:
    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username }}'
    password: '{{ vcenter_password }}'
    cluster_name: my_cluster
    schema: vsphere
    properties:
        - name
        - configuration.dasConfig.enabled
        - summary.totalCpu
  register: _out

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

clusters

dictionary

A dictionary that describes the clusters found by the search parameters

The keys are the cluster names and the values are dictionaries with the cluster info.

Returned: On success

Sample: {"clusters": {"My-Cluster": {"datacenter": "My-Datacenter", "dpm_default_dpm_behavior": "automated", "dpm_enabled": false, "dpm_host_power_action_rate": 3, "drs_default_vm_behavior": "fullyAutomated", "drs_enable_vm_behavior_overrides": true, "drs_enabled": true, "drs_vmotion_rate": 3, "ha_admission_control_enabled": true, "ha_enabled": false, "ha_failover_level": 1, "ha_host_monitoring": "enabled", "ha_restart_priority": "medium", "ha_vm_failure_interval": 30, "ha_vm_max_failure_window": -1, "ha_vm_max_failures": 3, "ha_vm_min_up_time": 120, "ha_vm_monitoring": "vmMonitoringDisabled", "ha_vm_tools_monitoring": "vmMonitoringDisabled", "hosts": [{"folder": "/My-Datacenter/host/My-Cluster", "name": "Esxi-1"}, {"folder": "/My-Datacenter/host/My-Cluster", "name": "Esxi-2"}], "moid": "domain-c11", "resource_summary": {"cpuCapacityMHz": 514080, "cpuUsedMHz": 21241, "memCapacityMB": 1832586, "memUsedMB": 348366, "pMemAvailableMB": 0, "pMemCapacityMB": 0, "storageCapacityMB": 12238642, "storageUsedMB": 4562117}, "tags": [], "vsan_auto_claim_storage": false, "vsan_enabled": false}}}

Authors

  • Ansible Cloud Team (@ansible-collections)