This repository automates the lifecycle of vSphere Configuration Profiles using a GitOps approach. It supports onboarding new clusters and updating configurations via JSON drafts, ensuring consistency and automation across your vSphere environment.
- vcp_managed_clusters.yaml: Source of truth for cluster enablement.
- vc-*/: Auto-generated folders named after vCenter FQDNs.
- vc-/.json: Raw vSphere Configuration Profile for each cluster.
- scripts/: PowerShell scripts used by GitHub Actions.
enable_vcp.ps1: Handles cluster transition and initial JSON export.update_config.ps1: Creates and validates vCenter configuration drafts.
Trigger: Any change to vcp_managed_clusters.yaml.
- Modify
vcp_managed_clusters.yaml: Add a new cluster entry under the respective vCenter.vc-mgmt-01.vcf.lab: clusters: - name: "cluster-wld-01" managedByVCP: true refHost: "esx-01.vcf.lab"
- Automation:
- Detects the new cluster.
- Connects to vCenter and initiates the VCP transition (Eligibility check → Import from Host → Enable).
- Exports the configuration profile to a new folder:
vc-mgmt-01.vcf.lab/cluster-wld-01.json. - A GitHub Bot commits the new JSON back to the main branch.
Trigger: Any change to a .json file within a vc-*/ folder.
- Modify a JSON file: Update settings (e.g., NTP, DNS, vSwitch configs) directly in the cluster's JSON file.
- Automation:
- Detects the modified file.
- Creates a Configuration Draft in vCenter.
- Imports the new JSON into that draft.
- Triggers a Validation Task in vCenter.
- The GitHub Action log reports if the draft is VALID.
Important
This workflow creates a Draft from the updated config file and applies. Upon successful validation VCP triggers remediation on all the hosts in a cluster.
Configure these secrets in Settings > Secrets and variables > Actions:
VC_USERNAME: Service account with VCP and Cluster Administrator privileges.VC_PASSWORD: Password for the service account.
This project requires a self-hosted runner with:
- PowerShell 7+ (
pwsh) - VCP.PowerCLI Module (v9.0+)
- powershell-yaml Module
- No Manual JSON Creation: Do not create the
vc-*/folders manually. Add clusters tovcp_managed_clusters.yamland let the bot handle folder and JSON creation. - JSON Validation: Ensure the JSON structure remains intact. Automation uses
[System.IO.File]for raw data integrity. - Atomic Commits: Commit one cluster change at a time for cleaner logs, though parallel processing is supported.