Hi,
Since I didn’t like inputting all the required commands every time I wanted to push a conferencing node to Proxmox, here’s a little bash script for that. Maybe someone else apart from me finds good use for it ![]()
Currently asks for password for SSH, can be modified to use keys instead.
#!/bin/bash
echo "=== Conferencing Node Deployment to Proxmox ==="
read -rp "Enter Proxmox host (IP or hostname): " PVE_HOST
read -rp "Enter Proxmox SSH username (default: root): " PVE_USER
PVE_USER=${PVE_USER:-root}
read -rp "Enter path to Pexip image (.raw or .vmdk) on this workstation: " IMG_PATH
if [[ ! -f "$IMG_PATH" ]]; then
echo "ERROR: File $IMG_PATH not found!"
exit 1
fi
read -rp "Enter new VM ID: " VMID
read -rp "Enter VM name (default: pex-node): " VMNAME
VMNAME=${VMNAME:-pex-node}
read -rp "Enter number of CPU cores (default: 4): " CORES
CORES=${CORES:-4}
read -rp "Enter memory in MB (default: 4096): " MEM
MEM=${MEM:-4096}
read -rp "Enter network bridge (default: vmbr0): " BRIDGE
BRIDGE=${BRIDGE:-vmbr0}
read -rp "Enter Proxmox storage (default: local-lvm): " STORAGE
STORAGE=${STORAGE:-local-lvm}
# Transfer image
echo "Transferring image to Proxmox..."
scp "$IMG_PATH" "${PVE_USER}@${PVE_HOST}:/var/lib/vz/template/"
BASENAME=$(basename "$IMG_PATH")
EXT="${BASENAME##*.}"
read -rp "Start VM immediately after creation? (y/n): " STARTNOW
# Single SSH session with forced TTY
ssh -t -t "${PVE_USER}@${PVE_HOST}" bash <<EOF
set -e
echo "Creating VM $VMID..."
qm create $VMID --name $VMNAME --memory $MEM --cores $CORES --net0 virtio,bridge=$BRIDGE --cpu host
IMGFILE=/var/lib/vz/template/$BASENAME
if [[ "$EXT" == "vmdk" ]]; then
echo "Converting VMDK to RAW..."
qemu-img convert -f vmdk -O raw \$IMGFILE /var/lib/vz/template/${BASENAME%.vmdk}.raw
IMGFILE=/var/lib/vz/template/${BASENAME%.vmdk}.raw
fi
echo "Importing disk into $STORAGE..."
qm importdisk $VMID \$IMGFILE $STORAGE
DISK_ID=\$(pvesm list $STORAGE | grep "vm-${VMID}-disk" | awk '{print \$1}' | tail -n1)
echo "Attaching disk \$DISK_ID..."
qm set $VMID --scsihw virtio-scsi-pci --scsi0 \$DISK_ID
qm set $VMID --boot c --bootdisk scsi0
echo "Cleaning up uploaded images..."
rm -f /var/lib/vz/template/$BASENAME
[[ "$EXT" == "vmdk" ]] && rm -f /var/lib/vz/template/${BASENAME%.vmdk}.raw
echo "Cleanup complete."
if [[ "$STARTNOW" =~ ^[Yy]$ ]]; then
echo "Starting VM $VMID..."
qm start $VMID
fi
echo "VM $VMID ($VMNAME) deployed successfully."
EOF