Skilllibrary proxmox-shell-scripting
install
source · Clone the upstream repo
git clone https://github.com/merceralex397-collab/skilllibrary
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/10-cli-systems-and-ops/proxmox-shell-scripting" ~/.claude/skills/merceralex397-collab-skilllibrary-proxmox-shell-scripting && rm -rf "$T"
manifest:
10-cli-systems-and-ops/proxmox-shell-scripting/SKILL.mdsource content
Purpose
Automate Proxmox VE operations using
pvesh, qm, pct, and vzdump shell commands.
When to use this skill
- scripting VM creation/cloning with
qm - managing LXC containers with
pct - automating backups and restores with
/vzdumpqmrestore - querying cluster status and storage via
pvesh
Do not use this skill when
- performing generic Ubuntu/Debian admin — prefer
linux-ubuntu-ops - writing systemd units for services — prefer
systemd-services - managing Docker containers — different tooling
Procedure
- Query cluster —
to check node health.pvesh get /cluster/status --output-format json - Create VM —
.qm create <vmid> --name <n> --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 --scsi0 local-lvm:32 - Create LXC —
.pct create <ctid> local:vztmpl/<tpl>.tar.zst --hostname <n> --memory 512 --rootfs local-lvm:8 - Cloud-init —
.qm set <vmid> --cicustom "user=local:snippets/user-data.yml" --ipconfig0 ip=dhcp - Backup —
.vzdump <vmid> --storage backup-store --mode snapshot --compress zstd - Restore —
.qmrestore /var/lib/vz/dump/vzdump-qemu-<vmid>-*.vma.zst <new-vmid> --storage local-lvm - Manage storage —
to list pools;pvesm status
.pvesm alloc local-lvm <vmid> vm-<vmid>-data 50G - Bulk ops — loop over
.pvesh get /cluster/resources --type vm --output-format json | jq -r '.[].vmid'
Key patterns
#!/usr/bin/env bash set -euo pipefail clone_vm() { local template_id="$1" new_id="$2" name="$3" qm clone "$template_id" "$new_id" --name "$name" --full qm set "$new_id" --memory 4096 --cores 4 qm start "$new_id" } backup_all_running() { local vmids vmids=$(qm list | awk 'NR>1 && $3=="running" {print $1}') for vmid in $vmids; do vzdump "$vmid" --storage backup --mode snapshot --compress zstd done }
Decision rules
- Always use
with--output-format json
— parse withpvesh
.jq - Use snapshot mode for backups of running VMs — stop mode causes downtime.
- Prefer
over manual disk copy for reproducibility.qm clone --full - Store cloud-init snippets in
./var/lib/vz/snippets/ - Test destructive operations on a non-production node first.
References
Related skills
— underlying OS administrationlinux-ubuntu-ops
— shell scripting fundamentalsbash
— remote Proxmox managementssh-tmux-remote-workflow