Use case 2 – ESXi hosts and cluster management

We will now try to carry out some higher-level infrastructure management. We will try to create a VMware cluster and add an ESXi host to it:

---
- name: Create a VMware cluster and populate it
hosts: localhost
gather_facts: False
tasks:
- name: Create a VMware virtual cluster
vmware_cluster:
hostname: 'vcenter.edu.lab'
username: '[email protected]'
password: 'VMp@55w0rd'
datecenter: 'vcenter.edu.lab'
validate_certs: no
cluster_name: "LabCluster"
state: present
enable_ha: yes
enable_drs: yes
enable_vsan: no

- name: Add a VMware ESXi host to the newly created
Cluster
vmware_host:
hostname: 'vcenter.edu.lab'
username: '[email protected]'
password: 'VMp@55w0rd'
datecenter: 'vcenter.edu.lab'
validate_certs: no
cluster_name: " LabCluster "
esxi_hostname: "esxi1.lab.edu"
esxi_username: "root"
esxi_password: "E5X1P@55w0rd"
state: present

These playbooks can replace both the PowerCLI commands that are used to manage the VCenter and the manual process of accessing the Windows client or the web interface to manage hosts and clusters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.70.203