The vmware_cluster module

This module allows you to manage your VMware vSphere cluster. A VMware vSphere cluster is a collection of hosts, which when clustered together share resources, allowing you to add high availability (HA) and also launch a Distributed Resource Scheduler (DRS) which manages the placement of workloads within your cluster:

- name: Create a cluster  vmware_cluster:    hostname: "{{ item.ip }}"    datacenter_name: "my_datacenter"    cluster_name: "cluster"    enable_ha: "yes"    enable_drs: "yes"    enable_vsan: "yes"    username: "{{ item.username }}"    password: "{{ item.password }}"  with_items: "{{ vsphere_hosts }}"

The preceding code would loop through a list of hosts, usernames, and passwords to create a cluster.

Get Learn Ansible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.