vm_guest_provision
Run ordered guest operations on a VM—upload files, execute commands, and manage services—in a single provisioning call. Stops on first failure.
Instructions
[WRITE] Provision a VM by running a sequence of guest operations (exec / upload / service).
Combines key injection, software installation, and service startup into a single call. Steps execute in order; stops on first failure.
Step types:
exec: {"type": "exec", "command": "apt-get install -y nginx"}
upload: {"type": "upload", "local_path": "/tmp/id_rsa.pub", "guest_path": "/root/.ssh/authorized_keys"}
service: {"type": "service", "name": "nginx", "action": "start"}
Args: vm_name: Target VM name. username: Guest OS username. password: Guest OS password. steps: Ordered list of step dicts. timeout: Per-step timeout in seconds (default 300). target: Optional vCenter/ESXi target name from config.
Returns: dict with success, completed_steps, total_steps, results, error.
Example: steps = [ {"type": "upload", "local_path": "~/.ssh/id_rsa.pub", "guest_path": "/root/.ssh/authorized_keys"}, {"type": "exec", "command": "chmod 600 /root/.ssh/authorized_keys"}, {"type": "exec", "command": "apt-get install -y nginx"}, {"type": "service", "name": "nginx", "action": "enable"}, {"type": "service", "name": "nginx", "action": "start"}, ]
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vm_name | Yes | ||
| username | Yes | ||
| password | Yes | ||
| steps | Yes | ||
| timeout | No | ||
| target | No |