Documentation Index
Fetch the complete documentation index at: https://docs.xloud.tech/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Xloud Compute supports automatic execution of customer-supplied scripts at virtual machine launch time and at any later point during the machine’s lifecycle. The mechanism is the industry-standard cloud-init agent on Linux guests and Cloudbase-Init on Windows guests — both consume the same Xloud metadata service so the same launch flow works for every supported OS.- At provisioning — the hypervisor executes Bash or PowerShell scripts during virtual machine creation to automate system bootstrapping operations (installing packages, configuring services, joining clusters, registering with monitoring, etc).
- On provisioned and discovered instances — the same scripting mechanism can be invoked on already-running and previously-imported virtual machines as part of an operational workflow (re-bootstrap, re-key, rotate credentials, patch in place, run a one-off task).
- A guest image with
cloud-init(Linux) orCloudbase-Init(Windows) pre-installed. The Xloud public image catalog ships with both. - A network or metadata route from the instance to the Xloud metadata
service (link-local
169.254.169.254over the management network is enabled by default). - For post-provisioning execution: SSH (Linux) or WinRM (Windows) reachability from the orchestration host, or an attached qemu-guest- agent channel.
Supported Script Formats
The user-data payload is read once by the agent on first boot. The first line of the payload tells the agent how to interpret the rest.| Header line | Treated as | Runs on |
|---|---|---|
#!/bin/bash (or #!/bin/sh, #!/usr/bin/env python3, etc.) | A shebang script | Linux (cloud-init) |
#cloud-config | Declarative YAML — packages, users, files, run commands | Linux (cloud-init) |
#include | Fetches a script from a URL | Linux (cloud-init) |
Content-Type: multipart/mixed (MIME) | Multiple payloads in one upload | Linux (cloud-init) |
#ps1 or #ps1_sysnative | PowerShell script | Windows (Cloudbase-Init) |
#cmd | Classic Windows command prompt batch | Windows (Cloudbase-Init) |
#cloud-config | Declarative YAML (subset supported) | Windows (Cloudbase-Init) |
Provisioning a VM with a Script
The user-data input lives in the System Config step of the launch wizard, under Advanced Options → User Data, and is mirrored by the--user-data flag on the CLI.
- Dashboard
- CLI
Open the launch wizard
Expand Advanced Options
Paste or upload the script
.sh, .yaml, .ps1, or .cmd file.| Limit | Value |
|---|---|
| Maximum payload size | 16 KB (before base64 encoding) |
| Encoding | UTF-8, ASCII safe |
| Forbidden characters | None — full Unicode allowed inside the script body |
Confirm and launch
final stage —
typically within 30–90 seconds of the VM going Active./var/log/cloud-init.log (Linux) or C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\cloudbase-init.log (Windows) confirm successful execution.Linux Bootstrap Examples (Bash and cloud-config)
Bash script — install and start nginx
cloud-config YAML — declarative bootstrap
Windows Bootstrap Examples (PowerShell and cmd)
PowerShell script — install IIS and write a marker
#ps1_sysnative runs the script through the native 64-bit PowerShell
on 64-bit Windows guests, avoiding the 32-bit WoW64 redirector. Use
#ps1 if you specifically need the 32-bit engine.Classic command prompt — register the VM with internal DNS
cloud-config on Windows — restricted subset
Running Scripts on Provisioned or Discovered Instances
For operational workflows that fire after a VM has been provisioned — or on instances that were imported into Xloud through migration or discovery — the same scripting mechanism is available. Choose the path that fits your security and connectivity model.Rebuild with new user-data (Bash or PowerShell)
Rebuild with new user-data (Bash or PowerShell)
Ansible against the instance IP
Ansible against the instance IP
shell module handles Bash
payloads on Linux, and win_shell / win_command handle Bash-via-
WSL or PowerShell on Windows.ansible-playbook run picks up newly-launched VMs without manual
inventory editing.qemu-guest-agent (hypervisor-side execution)
qemu-guest-agent (hypervisor-side execution)
hw_qemu_guest_agent=yes property set on its source image, the
administrator can send commands directly through the virtio-serial
channel — no SSH or WinRM is required. This is the path that
satisfies “execute scripts on a discovered VM” when the VM has no
public network reachability.guest-exec on Windows guests for
PowerShell payloads.Re-run cloud-init on the next boot
Re-run cloud-init on the next boot
cloudbase-init --reset-service-password style flow.Verification
| Layer | How to check | Expected |
|---|---|---|
| Cloud-init invoked | sudo cloud-init status --long (Linux) | status: done |
| Cloudbase-Init invoked | Inspect cloudbase-init.log | Final line reads Plugins execution done |
| User-data was visible to the guest | curl http://169.254.169.254/openstack/latest/user_data from inside the VM | Returns the exact payload you submitted |
| Script ran | Check the marker file written by your script | File exists and is recent |
| Errors during run | sudo cloud-init analyze show (Linux) or cloudbase-init.log (Windows) | No ERROR lines |
Troubleshooting
The script never ran
The script never ran
which cloud-init (Linux) or check for the Cloudbase-Init
service in services.msc (Windows). If absent, rebuild the image
or pick one from the Xloud public catalog.The script ran but failed silently
The script ran but failed silently
set -euxo pipefail at the top of a Bash payload and
$ErrorActionPreference = "Stop" at the top of a PowerShell payload
to force errors to surface. Then re-run with the rebuild action
above and check the log files listed in Verification.Payload too large — 16 KB limit
Payload too large — 16 KB limit
#include https://repo.internal/bootstrap.sh as the user-data; the
agent fetches and executes it inline.PowerShell complains about execution policy
PowerShell complains about execution policy
cannot be loaded because running scripts is disabled, the script
is being launched by something other than Cloudbase-Init — check
Scheduled Tasks or third-party agents that may have been baked into
the image.The user-data ran once but I want it to run on every boot
The user-data ran once but I want it to run on every boot
runcmd and shell scripts once per instance ID.
For per-boot execution use bootcmd: in #cloud-config, or
schedule a systemd unit that fires on boot. On Windows, set the
Cloudbase-Init plugin policy to BootStatusPolicy = AlwaysRun in
cloudbase-init.conf.Security Considerations
- Treat user-data as code, not config. It runs as root on Linux and
as Administrator on Windows. Anyone with
compute:create_serverpermission can submit it. - Do not embed secrets in user-data. The metadata service is reachable by every process inside the guest. Use Xloud Key Management for secrets and fetch them at runtime over an authenticated channel.
- Network reachability of the metadata service. Restrict the metadata route in tenant security groups when an instance is moved to a hardened production segment — cloud-init will not need it after first boot.
- Audit script content. XAVS Deployment Automation’s
--checkmode renders the playbook diff before execution. Use it for any multi-host operational workflow.