Infrastructure & virtualisation

How to Set Up Proxmox Automation: A Field Guide for Hosting Companies

An automation architecture for moving beyond manual VM cloning and IP spreadsheets in Excel, and delivering WHMCS or WISECP orders on Proxmox VE without errors.

Nothing goes wrong with the first 15 customers; by the 40th, things get messy

When you first launch a VDS operation, everything is simple. The customer places an order, you log in to the Proxmox interface, clone a ready-made Ubuntu template, find a free IP in a text file kept on the side and type it in by hand, then send the password in the support ticket. With two or three orders a day, this routine holds up.

The trouble starts with orders that arrive at midnight, with two different support staff accidentally giving the same IP to two machines, or with a server whose invoice was never paid being left running for days. This is exactly the breaking point where the need for Proxmox automation arises. The goal is not to put a button on the screen; it is to tie the link between the order, the invoice, the IP pool and the Proxmox task to a single source of truth.

Do not connect automation with the root@pam password

The most common mistake we see in the field is entering the root@pam username and password directly into the billing module. When a member of the support staff leaves, or when panel backups are moved, that password ends up floating around. Instead, create a user and an API token on Proxmox that are dedicated to automation only. We have shared the detailed permission matrix step by step in the article Proxmox API tokens and permission management.

pveum user add automation@pve --comment "VMRobot Automation"
pveum role add VMRobotRole -privs "VM.Allocate VM.Audit VM.Clone VM.Config.CPU VM.Config.Cloudinit VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Console VM.Migrate VM.Monitor VM.PowerMgmt Datastore.AllocateSpace Datastore.Audit SDN.Use"
pveum aclmod / -user automation@pve -role VMRobotRole
pveum user token add automation@pve panel --privsep=1

Do not skip the --privsep=1 flag. Without it, the token also inherits any additional permissions that its user may be given in the future; when the token gets its own separate permissions, you have drawn the boundary from the start.

Three classic mistakes on the template side

Half of all automated deployments break at the network or password injection stage. The cause is usually not Proxmox but the way the template was prepared:

  • Images without a Cloud-Init disk: If you use an official cloud image for a Linux template and finalise the template without attaching the cloud-init drive with qm set <id> --ide2 local-lvm:cloudinit, newly created VMs will not receive an IP or a password. For the preparation workflow, take a look at the Cloud-Init template preparation guide.
  • Cloning without clearing the machine-id: If you do not run truncate -s 0 /etc/machine-id and rm -f /var/lib/dbus/machine-id before finalising the template, DHCP or monitoring agents will clash because the clones share the same identity.
  • qemu-guest-agent installed but the service stopped: Especially in Windows Server templates, if the VirtIO drivers are installed but the Guest Agent service is not started, password reset and IP verification calls from the panel time out.

The IPv4 pool and locked allocation

If two customers pay in the same second and the system's query for picking a free IP is not locked (row-level lock), the same address is assigned to two virtual machines and an ARP conflict starts on the network. In automation that works correctly, IP selection is locked inside a database transaction and bound to the machine ID, and the gateway and netmask are written to the Cloud-Init configuration. When a service is cancelled, the system confirms that the machine has actually been deleted before the IP goes back to another customer.

For customers who send email or host business servers, managing reverse DNS (rDNS / PTR) records from the same pool also cuts the support workload considerably. Customers no longer have to open a ticket for every PTR change.

Handling timeouts and half-finished deployments

When you send a clone request to the Proxmox API, the operation does not finish immediately; Proxmox returns a UPID task ID. Cloning a 40 GB Windows template can take 25 seconds or 2 minutes, depending on how full the disk is. If the billing side times out after 30 seconds and resends the request, two separate VMs are created for the same order.

That is why the automation layer has to track the task in the background via its UPID. The request enters the queue once and is not triggered again until the task has completed and the machine is up. You can also read about the details of this lifecycle in the article Proxmox automation workflow.

How should you test the WHMCS and WISECP connection before you start selling?

Installing the module and seeing the green "Connection Successful" tick does not mean the job is done. Before taking on real customers, always run through the following sequence with your own test account:

  1. Create a test order with an approved payment; on the Proxmox side, verify that the machine was created on the right node, with the right RAM/CPU, the right disk size and the right IP.
  2. From the client panel, run the reboot, password change and OS reinstall operations one by one.
  3. Suspend the service; check that the VM shuts down and that the customer cannot start it again. Then unsuspend it.
  4. Finally, terminate the test service, which holds no data; check that the VM has been deleted and that the IP address has returned to the pool as free.

For platform-specific setup steps, see the WHMCS Proxmox module and WISECP Proxmox module pages. If VMs are already running on your existing physical servers, do not worry: with the VMRobot import tool you can bring those machines into the panel without shutting them down or reinstalling them. You can try it on your own server with a single command, using the licence that is free for life for up to 5 Proxmox hosts.