vcf_vm¶
vcf_vm resource type — one virtual machine per resource ID.
Each vcf_vm resource maps to a single VM, identified by its
vCenter MOID. The VM’s backing vCenter is referenced by ID so that one
minion can manage VMs across multiple vCenters without duplicating
connection credentials.
Pillar shape:
resources:
vcenter:
instances:
mgmt-vc:
host: mgmt-vc.vcf.nimbus.internal
username: administrator@vsphere.local
password: VMware123!VMware123!
verify_ssl: false
vcf_vm:
instances:
web-prod-01:
vcenter: mgmt-vc # references resources.vcenter.instances
moid: vm-1234 # vCenter managed object id
labels:
tier: production
app: web
web-prod-02:
vcenter: mgmt-vc
moid: vm-1235
labels:
tier: production
Once discovered, the operator can target any subset by grain:
salt -G 'tier:production' vcf_vm.power_off
salt -G 'app:web' vcf_vm.snapshot_create name=before-deploy
The framework injects __resource__["id"] so per-resource functions
never accept a VM identifier as an argument. labels and live vCenter
fields (name, power_state, cpu_count, memory_size_MiB) are surfaced as
grains so jq-style filtering works.
Discovery is purely pillar-driven in this resource type — auto-discovery from vCenter is intentionally deferred to phase 10b once Salt Resources ships discovery pagination.
- saltext.vcf.resources.vcf_vm.init(opts)[source]¶
Load vcf_vm and referenced vCenter instance configs into context.
- saltext.vcf.resources.vcf_vm.discover(opts)[source]¶
Return the list of VM resource IDs declared in pillar.
- saltext.vcf.resources.vcf_vm.grains()[source]¶
Identity + live-from-vCenter grains for the current VM.
Static (from pillar):
resource_type,resource_id,vcenter,moid, plus everylabels:entry promoted to a top-level grain so thatsalt -G 'tier:production'targeting works.Live (from vCenter):
name,power_state,cpu_count,memory_size_MiB. Best-effort — if vCenter is unreachable we return only the static grains.
- saltext.vcf.resources.vcf_vm.ping()[source]¶
Probe the backing vCenter session — the VM resource is reachable iff vCenter is.