Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provision Blocks

Provision blocks define steps to run on the guest after boot. They execute in order and abort on the first failure.

Shell Provisioner

Inline Command

provision "shell" {
    inline "sudo apt-get update && sudo apt-get install -y nginx"
}

Executes the command directly on the guest via SSH.

Script File

provision "shell" {
    script "scripts/setup.sh"
}

The script file is uploaded to /tmp/vmctl-provision-<step>.sh on the guest, made executable with chmod +x, and executed. The path is resolved relative to the VMFile directory.

Validation

A shell provisioner must have exactly one of inline or script. Specifying both or neither is an error.

File Provisioner

provision "file" {
    source "config/app.conf"
    destination "/etc/app/app.conf"
}

Uploads a local file to the guest via SFTP.

Required Fields

FieldDescription
sourceLocal file path (relative to VMFile directory)
destinationAbsolute path on the guest

Execution Behavior

  • Provisioners run sequentially in the order they appear.
  • Shell provisioners stream stdout and stderr to your terminal in real-time.
  • A non-zero exit code from any shell provisioner aborts the sequence.
  • All output is also logged to provision.log in the VM's work directory.
  • vmctl waits up to 120 seconds for SSH to become available before starting provisioners.