Esxi Debian Deploy
by @cepheiden
Zero-touch Debian 13 VM deployment on VMware ESXi 8. Builds custom preseed ISO, creates NVMe+vmxnet3 VM with serial console, and runs unattended installation...
clawhub install openbot-esxiπ About This Skill
name: esxi-debian-deploy description: Zero-touch Debian 13 VM deployment on VMware ESXi 8. Builds custom preseed ISO, creates NVMe+vmxnet3 VM with serial console, and runs unattended installation. Use when deploying Debian VMs on ESXi, automating VM provisioning, or setting up serial console access for headless ESXi VM management.
ESXi Debian 13 Zero-Touch Deploy
Deploy fully configured Debian 13 VMs on ESXi 8 in ~8 minutes with zero manual interaction.
Required Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| ESXI_HOST | Yes | ESXi host IP address |
| ESXI_PASS | Yes | ESXi root password |
| ESXI_USER | No | ESXi user (default: root) |
| ESXI_DATASTORE | No | Target datastore (default: datastore1) |
| NETWORK | No | Port group name (default: VM Network) |
| DOMAIN | No | Domain for VMs (default: local) |
| VM_PASS | Yes (resize only) | VM root password for disk resize script |
> β οΈ Note: The deploy script generates a random VM password and prints it to stdout. The password is also embedded in the preseed ISO uploaded to the ESXi datastore. Remove the ISO after deployment and treat stdout output as sensitive.
Requirements
bash, python3, wgetInstall on Debian/Ubuntu:
apt install xorriso isolinux sshpass
govc: https://github.com/vmware/govmomi/releases
Usage
All credentials are passed via environment variables β nothing is hardcoded or embedded in process arguments.
export ESXI_HOST="192.168.1.100"
export ESXI_PASS="your-esxi-root-password"bash scripts/esxi-deploy.sh [hostname] [cpu] [ram_mb] [disk_gb] [serial_port]
| Parameter | Default | Description | |-----------|---------|-------------| | hostname | random animal name | VM name | | cpu | 2 | vCPU count | | ram_mb | 2048 | Memory in MB | | disk_gb | 20 | Disk size in GB | | serial_port | random 8600-8699 | Telnet port for serial console |
Example:
bash scripts/esxi-deploy.sh webserver 4 4096 50 8610
What It Does
1. Generate preseed.cfg β German locale, DHCP, configurable user + root, random password
2. Build custom ISO β Debian netinst + preseed, patched isolinux for auto-boot
3. Upload ISO to ESXi datastore
4. Create VM β NVMe disk (thin provisioned), dual NIC (E1000 for installer + vmxnet3 for production), serial port via telnet
5. Boot + unattended install β preseed handles everything
6. Post-install β Remove E1000, eject ISO, set boot to HDD
7. Output credentials β SSH + serial console access details
Serial Console
Every VM gets a serial port accessible via telnet to the ESXi host:
telnet
Works even when the VM has no network. Configured:
GRUB_TERMINAL="console serial", serial 115200 8N1console=tty0 console=ttyS0,115200n8serial-getty@ttyS0.service enabledESXi firewall requirement (activated automatically by the script):
esxcli network firewall ruleset set -e true -r remoteSerialPort
Important: Set serial port IP to the ESXi host IP, not 0.0.0.0:
serial0.fileName = "telnet://:"
Online Disk Resize
Grow a VM's disk without shutdown:
export ESXI_HOST="192.168.1.100"
export ESXI_PASS="your-esxi-password"
export VM_PASS="vm-root-password"bash scripts/esxi-vm-resize-disk.sh
Requires cloud-guest-utils on the VM (pre-installed by the deploy script).
Configuration
All settings are configurable via environment variables:
export ESXI_HOST="192.168.1.100" # ESXi host IP (required)
export ESXI_PASS="secret" # ESXi root password (required)
export ESXI_USER="root" # ESXi user (default: root)
export ESXI_DATASTORE="datastore1" # Target datastore (default: datastore1)
export NETWORK="VM Network" # Port group name (default: VM Network)
export DOMAIN="example.local" # Domain for VMs (default: local)
No credential store or external resolver is required. Pass secrets via environment variables only β they are never embedded in process arguments or URLs.
VM Configuration Details
| Component | Choice | Reason | |-----------|--------|--------| | Disk controller | NVMe | Faster than SCSI/SATA for modern guests | | Production NIC | vmxnet3 | Paravirtualized, best performance | | Installer NIC | E1000 | Kernel driver built-in, no firmware needed | | Boot mode | BIOS | Simpler for automated installs | | Provisioning | Thin | Saves datastore space |
Preseed Highlights
de_DE.UTF-8, keyboard de, timezone Europe/Berlinopen-vm-tools, curl, sudo, qemu-guest-agent, cloud-guest-utilsPermitRootLogin yes, PasswordAuthentication yesfloppy, pcspkr (prevent I/O error loops in VMs)Customize the preseed section in esxi-deploy.sh for different locales or packages.
Security Considerations
govc uses GOVC_USERNAME/GOVC_PASSWORD env vars.sshpass for automated SSH. For production, consider SSH key-based auth instead.0.0.0.0), but anyone with network access to the ESXi host can connect. Restrict access via:remoteSerialPort to trusted IPs)
- Network segmentation / VPN
- Disable serial port after debugging
Gotchas
late_command β Shell expansion in the deploy script's heredoc destroys nested heredocs. Use echo -e or single-line commands instead.remoteSerialPort ruleset must be enabled.growpart on the root partition or redeploy with larger disk.References
π‘ Examples
All credentials are passed via environment variables β nothing is hardcoded or embedded in process arguments.
export ESXI_HOST="192.168.1.100"
export ESXI_PASS="your-esxi-root-password"bash scripts/esxi-deploy.sh [hostname] [cpu] [ram_mb] [disk_gb] [serial_port]
| Parameter | Default | Description | |-----------|---------|-------------| | hostname | random animal name | VM name | | cpu | 2 | vCPU count | | ram_mb | 2048 | Memory in MB | | disk_gb | 20 | Disk size in GB | | serial_port | random 8600-8699 | Telnet port for serial console |
Example:
bash scripts/esxi-deploy.sh webserver 4 4096 50 8610
βοΈ Configuration
All settings are configurable via environment variables:
export ESXI_HOST="192.168.1.100" # ESXi host IP (required)
export ESXI_PASS="secret" # ESXi root password (required)
export ESXI_USER="root" # ESXi user (default: root)
export ESXI_DATASTORE="datastore1" # Target datastore (default: datastore1)
export NETWORK="VM Network" # Port group name (default: VM Network)
export DOMAIN="example.local" # Domain for VMs (default: local)
No credential store or external resolver is required. Pass secrets via environment variables only β they are never embedded in process arguments or URLs.