Skip to content
bashrusakhPublic

About

vmctl is a modern CLI tool for creating, managing, and operating virtual machines on standalone ESXi without vCenter.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

vmctl

Standalone virtual machine management for VMware ESXi — without vCenter.

Release ESXi License

vmctl is a command-line tool for provisioning and operating virtual machines on a standalone ESXi host. It runs on a separate Linux management host and connects to one ESXi host over SSH and the vSphere API.

What it does

  • Creates VMs from prepared templates using cloud-init.
  • Supports multiple datastores, template placement rules and disk formats.
  • Applies resource limits and protects selected VMs from deletion.
  • Manages the VM lifecycle: create, inspect, delete and permanently purge.
  • Recovers interrupted operations and reconciles state with the ESXi inventory.
  • Validates configuration, credentials and helper connectivity before operations.
  • Keeps the ESXi helper identity separate from the SSH key installed in guest VMs.

How it works

vmctl targets a standalone ESXi host. vCenter is not required or used.

The normal execution path uses the restricted, forced-command SSH helper installed on ESXi. The helper exposes only the operations vmctl needs. The direct ESXi backend is a break-glass option for helper recovery; it is disabled by default and requires both an explicit configuration setting and the --allow-direct-esxi flag.

The management host runs the CLI and govc; the ESXi host stores VM files and executes helper operations. The tool does not depend on a particular agent platform or management product.

The runtime directory is fixed at /opt/vmctl in the current version. Keep APP_DIR=/opt/vmctl in install.env. The installer rejects another value because the CLI itself reads its files from this path.

Requirements

  • VMware ESXi 7.0 Enterprise or newer, installed as a standalone host.
  • A Linux management host.
  • Python 3.15 or newer and PyYAML.
  • govc available on the runtime user's PATH.
  • SSH connectivity from the management host to the ESXi helper account.

Installation

Choose one deployment path:

  1. Generic installation — prepare the runtime account, configuration, secrets and ESXi helper yourself. See the installation guide.
  2. Full-stack installation — use the bundled installer to prepare the Linux host, create the ESXi accounts and install the forced-command helper. See the bootstrap guide.

Quick start: full-stack installation

The current published v0.1.6 release asset retains the historical archive filename hermes-vmctl-v0.1.6.tar.gz. The installed application directory is /opt/vmctl; the archive filename does not determine the runtime path.

curl -fL https://github.com/bashrusakh/vmctl/releases/download/v0.1.6/hermes-vmctl-v0.1.6.tar.gz \
  -o /tmp/vmctl-release.tar.gz
tar -xzf /tmp/vmctl-release.tar.gz -C /tmp

# The release archive expands into /tmp/hermes-vmctl.
sudo install -d -m 750 /opt/vmctl
sudo cp -a /tmp/hermes-vmctl/. /opt/vmctl/
cd /opt/vmctl

cp install.env.example install.env
nano install.env
# Set AGENT_USER to an existing local account and keep APP_DIR=/opt/vmctl.

sudo scripts/install-full-stack.sh --env ./install.env

# The installer does not copy install.env; vmctl reads it from this path.
sudo chown vmctl-runner:vmctl /opt/vmctl/install.env
sudo chmod 600 /opt/vmctl/install.env

sudo -u vmctl-runner -H /opt/vmctl/bin/vmctl preflight
sudo -u vmctl-runner -H /opt/vmctl/bin/vmctl doctor

For a newer release, replace the tag and archive name with the matching asset on the Releases page.

For an existing installation under the former path, follow Migrating to /opt/vmctl.

Create a VM

When the configuration defines template resource defaults and guest-access defaults, a VM can be created with just its name and template:

vmctl create --name web-prod-01 --template alma10

Explicit options override configured defaults:

vmctl create \
  --name web-prod-01 \
  --template alma10 \
  --cpu 4 \
  --ram-mb 8192 \
  --disk-gb 80 \
  --network "VM Network" \
  --user admin \
  --ssh-key-file ~/.ssh/id_ed25519.pub \
  --ip dhcp

--ssh-key-file must point to the public key. The matching private key must exist at the same path without the .pub suffix, be readable by the runtime user and have mode 0600. The key halves must match.

Commands

Command Purpose
create Create a VM from a template.
status Show the state record of a VM, including its tombstone after deletion.
list List VM entities and their current phases.
delete Power off and unregister a VM, then move its directory to the tombstone area.
purge Permanently remove a deleted VM's tombstone.
recover Reconcile recorded VM state with the ESXi inventory.
reconcile Move artifacts of an interrupted create into the tombstone area.
preflight Check configuration, secrets, drift, govc and the helper.
doctor Run preflight checks plus runtime diagnostics.
mode Show the effective backend mode and ESXi target.
sync-check Compare the live configuration with the installer environment.

delete is a recoverable move, not permanent removal. It preserves the VM directory under the datastore's tombstone area. purge is the separate, destructive operation that removes that tombstone. Only names explicitly listed in protected_vms are protected from deletion.

The complete syntax, options and output contracts are in the CLI reference.

Output and exit codes

Commands print JSON to standard output. preflight and doctor show a human-readable report on a terminal and emit JSON when their output is piped or redirected.

vmctl preflight
vmctl preflight --format json
vmctl doctor --format text --no-color
Exit code Meaning
0 The command completed successfully.
1 The request was refused or the operation failed.
2 A diagnostic check failed, configuration drift was found, or recovery could not read the inventory.

Expected errors are reported as one concise line on standard error. Unexpected errors retain their traceback for diagnosis.

Security model

  • The forced-command SSH helper is the supported backend and exposes a restricted command set.
  • Direct mode is disabled by default; a CLI flag alone cannot enable it.
  • VM names, datastore paths and network selections are validated.
  • Resource quotas and protected_vms limit the scope of operations.
  • The ESXi helper keypair and the guest-login keypair are separate and must never be exchanged.
  • Deleted VMs are retained as tombstones until an explicit purge operation.

See the operations guide and troubleshooting guide for operational behavior and recovery procedures.

Documentation

Operator documentation

Document Covers
Installation guide Generic installation, runtime identity, fixed paths and permissions.
Bootstrap guide Full-stack installer, ESXi bootstrap, upgrade and migration.
CLI reference Commands, options, output formats and exit codes.
Configuration reference vmctl.yaml, secrets and install.env.
Operations VM lifecycle, state phases, quotas, diagnostics and recovery.
Troubleshooting Common errors and the checks to resolve them.
Operator skill Post-install procedure for an automation agent.

Developer documentation

Document Covers
Development guide Architecture, dependencies, tests and releases.
Contributing Contribution workflow, coding conventions and issue triage.
Agent instructions Repository-specific guidance for coding agents.

Release history


Made for clean and secure ESXi infrastructure.

About

vmctl is a modern CLI tool for creating, managing, and operating virtual machines on standalone ESXi without vCenter.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages