Centrally managed Ansible inventory for VMware hosts
An Ansible inventory for VMware hosts should describe where systems live, how they are grouped, and which variables apply to them. For an IT team, that means moving beyond a spreadsheet of ESXi names and toward a dependable source of truth for playbooks, compliance checks, reporting and day-to-day operations across multiple vCentres.
Central management is especially useful in Australia, where estates often span Sydney, Melbourne, Brisbane and Perth, with branch workloads connected by corporate WAN links. A common inventory can preserve consistent host metadata while allowing the execution controller to sit near the relevant vCentre API and avoid unnecessary interstate traffic.
The implementation can combine Git-backed inventory files with vSphere dynamic inventory discovery. This hybrid provides human-reviewed structure for environments and access rules, while live discovery supplies current hosts. It also creates a controlled path from a newly installed ESXi server to a managed, monitored and regularly patched configuration.
Define the estate and its source of truth
Begin by documenting the authoritative boundaries: vCentres, folders, clusters, tags and stand-alone ESXi hosts outside vCenter. Decide whether the inventory represents physical hosts, cluster endpoints or both. Most playbooks should act against vCenter objects, while individual ESXi systems remain targets when configuration must be inspected or changed directly.
Give every host an accountable owner and define which system wins when inventory data disagrees. Useful metadata includes environment, data-centre site, cluster, hardware generation, support status and maintenance window. Physical details such as rack, power circuit and patch lead can follow local facilities naming, including rack layouts aligned with AS/NZS 4364, without becoming part of the host’s identity.
Model host groups for real operations
Build groups around actions and lifecycle rather than around individual machine names. Examples include vmware_hosts, vmware_hosts_sydney, vmware_hosts_melbourne, vmware_hosts_production and groups based on vSAN, encryption or backup policy. These labels let a playbook target a capability while retaining site and environment context.
Keep stable variables in group_vars and host-specific exceptions in host_vars. Ansible’s variable precedence should resolve small deviations predictably instead of creating duplicate group definitions. Treat site, role, owner and policy identifiers as inventory data, but never place passwords or API tokens in a plain YAML file.
Combine static structure with dynamic discovery
The community.vmware.vmware_inventory plugin queries vCenter and returns host data and groups derived from folders, clusters and tags. Configure it with the vCenter FQDN and a credential reference, then connect it as a dynamic inventory source in AWX or Ansible Automation Platform. Map tags to operational groups, use keyed_groups for metadata such as site or environment, and apply filters that exclude retired equipment.
Retain a small static layer for groups and variables that cannot be inferred safely from vCenter. This is useful when an ESXi host is managed through a dedicated authorised service account, when a cluster needs a temporary exception, or when a local MSP owns part of an Australian estate. Dynamic discovery should populate membership; Git should review intent. Verify inventory_hostname values and set ansible_host to the management FQDN only when direct access is genuinely required.
Secure vCentre access and secrets
Create a dedicated vCenter service account with read access to the folders and clusters in scope, plus the least additional permissions needed for each action. Restrict the account to managed hosts, validate the vCenter certificate and avoid disabling certificate checks to make a connection work. Where supported, use vCenter tag-based permissions to constrain access to tagged objects.
Keep reusable credentials in the AWX or Ansible Automation Platform credential store, or in encrypted Ansible Vault files with separate keys for each environment. Rotate the service account and certificates on a defined schedule, and audit who can launch jobs or reveal variables. Australian organisations in healthcare, finance and government often need clear data-residency and audit evidence, so the controller, logs and backups should remain in approved Australian regions.
Test connectivity and host readiness
The execution controller must resolve the vCenter FQDN, reach TCP port 443, trust the certificate chain and keep clocks synchronised. ESXi SSH access is not needed for API-based work; use VMware modules and vCenter objects wherever possible. Disable SSH only after confirming that no legacy playbook depends on it, since direct host access expands the attack surface and creates brittle network dependencies.
Run a read-only discovery play against one non-critical cluster and inspect the returned groups, facts and host variables. Measure latency from the controller to each vCenter, especially across a Perth or Brisbane branch link, and adjust polling and timeouts before scaling. Before turning performance thresholds into automated decisions, the practical measurements in calibrating vSphere host performance provide a sound baseline for capacity checks.
Automate execution through AWX or Ansible Automation Platform
Store inventory, role variables and playbooks in Git, then let AWX or Ansible Automation Platform execute them from a reviewed revision. Define job templates for discovery, compliance, patching and reporting, with separate credentials and inventories for production and non-production. Refresh dynamic inventory at the start of a job so group membership reflects the current vCenter state.
Use pull requests, ansible-lint, syntax checks and a limited check-mode run before merging changes. Record inventory refresh output and job logs as build artefacts, then review them for unexpected host counts. The same promotion model works when creating a Kubernetes cluster, where reviewed manifests, repeatable automation and controlled credentials should travel through the same operational workflow.
Maintain the inventory as code
Onboarding and retirement need explicit inventory changes. Tag a new ESXi host in vCenter, add any site or policy metadata in Git, verify the dynamic group and then release the update through the normal approval path. Remove decommissioned systems from both vCenter and inventory so automation does not target stale names. Schedule a monthly reconciliation of host counts, tags, support coverage and group membership.
At scale, monitor vCenter API calls, dynamic inventory duration, job queue depth and controller capacity. Split jobs by site or policy rather than launching one play against every host, which reduces contention and makes failures easier to isolate. Schedule maintenance using Australian Eastern Standard Time or Australian Eastern Daylight Time, including daylight-saving transitions, and record both local and UTC timestamps. In the Australian market, shared responsibility among internal platform teams, consultancies and MSPs works best when ownership, approval rights and inventory changes remain visible in one auditable process.
Start with one vCentre and one non-production cluster. Create the service account, define the static groups, enable dynamic discovery and publish the resulting inventory for review before adding further sites.
Create the inventory repository now, connect one authorised vCentre through least-privilege access, and make the first host group visible to the whole operations team.