What are provisioners?
Provisioners handle post-allocation machine setup - installing packages, deploying guest plugins, running configuration scripts, and taking snapshots. After a provider allocates a machine, provisioning steps prepare it for analysis. Provisioners are transport-agnostic: each provisioner manages its own connectivity to the machine (WinRM, SSH, etc.). Like providers, provisioners register themselves at compile time using theinventory crate and can be developed independently.
Running provisioning
Provisioning is driven through themalbox CLI. Each invocation runs a single provisioning step against a machine via the daemon’s HTTP API (POST /v1/machines/{id}/provision).
| Flag | Required | Description |
|---|---|---|
--provisioner | Yes | Provisioner type (e.g. "ansible"). |
--snapshot | No | Snapshot name to create after successful provisioning. |
--revert-to | No | Snapshot to revert to before provisioning (defaults to "base"). |
--config | No | Provisioner-specific config as JSON. |
--plugins | No | Guest plugin names to deploy (resolved from the daemon’s plugin registry). |
What happens during a provision step
- The machine transitions to
provisioningstate (prevents concurrent provisioning) - The VM is reverted to the
--revert-tosnapshot (defaults to"base") for a clean starting state - The VM is started and the daemon waits for the management service (WinRM on port 5986 for Windows, SSH on port 22 for Linux) to become reachable
- The provisioner runs (e.g. Ansible executes the playbook)
- The VM is stopped
- If
--snapshotwas specified, a provider-level snapshot is taken and recorded in the database - The machine transitions back to
ready
Multi-step provisioning
To build up a machine in layers, run multiple provision commands, each snapshotting after completion. Later steps can use--revert-to to start from a previous step’s snapshot:
Architecture
The provisioner system follows the same pattern as providers:Provisionertrait - defines the contract all provisioners must implement: an asyncprovision(context)method and aname()method.ProvisionerMetadata- registered at compile time via theinventorycrate. Contains the provisioner name and a factory function.ProvisionContext- passed to the provisioner with the machine’s network endpoint (IP, platform) and the step’s TOML config.ProvisionResult- returned by the provisioner with a status (SuccessorFailed) and optional output text.
create_provisioner(name, config).
Supported provisioners
Ansible
The built-in Ansible provisioner runs Ansible playbooks against allocated machines. It auto-generates dynamic inventory when needed and injects plugin metadata as extra variables.Configuration
| Field | Type | Default | Description |
|---|---|---|---|
playbook | string | (required) | Path to the Ansible playbook to execute. Must exist on disk. |
inventory | string | "dynamic" | Inventory source. Set to "dynamic" to auto-generate a temporary inventory with the machine IP, or provide a path to a static inventory file. |
extra_vars | table | {} | Extra variables passed to ansible-playbook --extra-vars. |
plugins | table | {} | Plugin entries resolved by the daemon. Each key is a plugin name with binary, manifest, and port fields. |
timeout | integer | 1800 | Timeout in seconds for the ansible-playbook process. |
ansible_bin | string | "ansible-playbook" | Path to the ansible-playbook binary. |
Dynamic inventory
Wheninventory = "dynamic" (the default), the provisioner generates a temporary inventory file containing the machine’s IP address. For Windows machines, it automatically adds WinRM connection variables:
Guest plugin injection
When plugins are specified (either via--plugins on the CLI or guest_plugins in the pipeline), the Ansible provisioner resolves each plugin’s plugin.toml manifest. It then injects a guest_plugins extra variable as a JSON array. Each entry includes:
paths are resolved from the plugin’s [runtime.paths] in plugin.toml, so playbooks can create the correct directories on the guest without hardcoding paths.
Bundled playbooks
Malbox ships a modularprovision.yml playbook for Windows that composes two steps:
- Auto-login configuration - configures the sandbox user for interactive sample execution
- Guest plugin deployment - copies plugin binaries and manifests, creates runtime directories, sets up scheduled tasks to start plugins on login
skip_plugins, skip_autologin):