Audit vSphere Permissions with Ansible

A vSphere permissions audit should answer a practical question: who can change infrastructure, and through which role, group, or host account? Manual exports miss disabled identities, inherited assignments, and direct ESXi access. Ansible collects evidence consistently and makes access drift easier to detect.

The useful result is an evidence-based view of effective entitlements: direct grants, group-derived access, permission propagation, and unusually broad privileges. Each finding should retain its source, timestamp, account state, and scope so a reviewer can reproduce it.

Across the Australian market, including organisations in Sydney, Melbourne and Brisbane, vSphere estates combine Active Directory or Microsoft Entra ID with site administration. Identity resolution and a defensible audit trail help map access to Australian Signals Directorate Essential Eight controls and the OAIC Privacy Act.

Ansible can query vCenter authorisation data, enrich it with identity data, compare snapshots, and publish findings for Australian infrastructure and security teams.

Choose the audit scope and evidence

Start by defining whether the audit covers vCenter RBAC, local ESXi host roles, or both. Include folders, resource pools, clusters, datacentres, and service accounts in scope. A repeatable baseline is more valuable than a one-off account listing.

Evidence source What it shows Strength Blind spot
vCenter REST API Role assignments Authoritative RBAC No group data
Identity provider Membership and state Effective access Needs mapping
ESXi host roles Local permissions Finds bypasses Separate RBAC

Combine vCenter REST data, identity-provider membership, ESXi-local roles, and the previous output. Record UTC and AEST or AEDT times, the vCenter version, and API endpoints so daylight-saving changes never make schedules ambiguous.

Build read-only vSphere access

Apply least privilege: create a dedicated automation identity with only the inventory and authorisation metadata needed for collection. Do not reuse a human administrator or permit changes to roles, permissions, users, or groups. Store credentials in Ansible Vault, a secrets manager, or a controller's credential facility.

The community.vmware collection is a starting point, but community.vmware.vmware_host_role_info covers ESXi host roles, not the complete vCenter RBAC graph. For vCenter-wide auditing, use Ansible's uri module to call permission, role, user, and group endpoints. Check API Explorer for the deployed version because session paths differ.

Start with /api/session, then /api/vcenter/authorization/permissions, /api/vcenter/authorization/roles, /api/vcenter/authorization/users, and /api/vcenter/authorization/groups; older vSphere releases may use /rest/com/vmware/cis/session. Register the session with no_log: true, and fail the play when authentication succeeds but no permission records are returned.

Map roles, groups, and privileges

A permission record links a principal to a role, but that is not the end of the audit. Resolve direct users and groups, then add memberships inherited from Active Directory or Entra ID. An account can be disabled in the directory yet remain assigned in vCenter, so reconcile both states and retain each source.

Normalise built-in and custom roles into meaningful capabilities such as modifying virtual machines, cloning workloads, altering datastores, managing snapshots, or interacting with hosts. Review system-defined roles containing privilege-escalation or host-management rights while accounting for resource scope and permission propagation.

For portfolio context, Jonathan Frappier’s background details his infrastructure and automation experience. It reinforces the priority: collect facts consistently before recommending access changes.

Compare risk before and after

Prioritise access paths rather than role labels alone. A dormant administrator account can matter more than a tightly scoped custom role, while an active group with datastore access may expose every cluster receiving the permission. Validate business ownership before classifying a finding as misuse.

Store each successful run as a versioned snapshot and diff it against the previous result. New grants, removed accounts, changed roles, and assignment drift become reviewable events. Severity can combine account status, privilege breadth, resource scope, and the likelihood of bypassing centralised controls.

These artefacts support evidence mapping for Essential Eight access-control and logging requirements. They can support Privacy Act and Notifiable Data Breaches scheme reviews, although output alone does not establish compliance or determine whether a notifiable incident occurred.

Checks that make findings actionable

Turn raw assignments into findings that an owner can act on without reverse-engineering the API response.

Identity and entitlement checks

Remediation evidence

Each finding should include the principal, source, role, scope, triggered rule, and expected remediation. Avoid saving passwords, session tokens, or unnecessary personal data in reports.

Store and review audit evidence

Keep JSON for processing, normalised CSV for reviewers, and a short Markdown summary for infrastructure and security leads. Include play and collection versions, vCenter build, collection time, and lookup failures. Label partial results rather than presenting them as a clean bill of health.

The version-controlled audit workflows guide shows how Git can preserve reviewable change history. Commit sanitised summaries and machine-readable outputs through an approved pipeline; never commit API sessions, Vault values, or unreviewed personal information.

Use pull requests or equivalent approvals for detection-rule changes, and schedule collection at 02:00 UTC so it stays predictable when Australian Eastern Standard and Daylight Time changes. Apply Australian organisational retention requirements and restrict access to principal and group data.

Turn the audit into a routine control

Run the audit from AWX, Ansible Automation Platform, or a controlled CI job with a read-only service account. Check for authentication failures, empty responses, schema changes, and unresolved directory lookups. A failed run should raise an alert, not overwrite the last known-good baseline.

Deploy the first read-only collection against a non-production vCenter, review the role-to-capability mapping, and enable scheduling only after the output matches a manually verified sample. Publish the sanitised baseline, assign every finding an owner, and rerun the audit after remediation.