| name | proxmox-safety-rules |
| description | Safety rules for Proxmox host management, remote operations, and credential protection. Includes network safety, cleanup completeness, and authentication preservation. |
Proxmox Host Safety Rules
Use when managing remote Proxmox hosts, handling network changes, performing cleanup, or working with SSH connections to prevent catastrophic failures.
Rules
- NEVER use
ifdown --all, systemctl stop networking, or ip link delete vmbr0 on remote hosts
- NEVER hardcode bridge names (vmbr0, vmbr1) - WAN bridge is detected at runtime via default route
- NEVER apply WAN_MAC at VM NIC level - always use MAC conflict detection flow
- NEVER remove SSH keys or API tokens during cleanup - they are operator prerequisites
- NEVER escape shell variables without proper escaping - always use
\$ for $ in SSH commands
- NEVER use
grep -q in pipelines with set -o pipefail - use grep -c instead
- NEVER use local_action - always use
delegate_to: localhost
- ALWAYS escape
$ as \$ in double-quoted SSH commands
Patterns
Detached restart pattern:
- name: Schedule restart via detached script
ansible.builtin.raw: >-
printf '#!/bin/sh\nsleep 3\n/etc/init.d/network restart\nsleep 5\n/etc/init.d/dropbear restart\nrm -f /tmp/_restart_net.sh\n'
> /tmp/_restart_net.sh &&
chmod +x /tmp/_restart_net.sh &&
start-stop-daemon -S -b -x /tmp/_restart_net.sh
ignore_unreachable: true
WAN MAC conflict detection flow:
Shell escaping in SSH:
ssh host "... awk '{print \$2}' ..."
ssh host "... awk '{print $2}' ..."
GPU Driver and Host Crash Prevention
- NEVER run
modprobe -r amdgpu on single-GPU AMD hosts — kernel panic
- NEVER run
modprobe -r amdgpu/i915 in broad-scope plays (hosts: proxmox*) — PCI rescan is sufficient for E2E cleanup
- ONLY run GPU driver unload in per-feature cleanup gated on VGA count >= 2
- Every host has
wol_capable (true/false) in host_vars — non-WoL hosts cannot be recovered remotely
tests/test_host_safety.py catches this pattern statically at pytest time
- Previous bug: E2E cleanup
modprobe -r amdgpu kernel-panicked ai (single AMD GPU, USB ethernet). Required physical power-on
Anti-patterns
NEVER explain what Proxmox is in safety rules
NEVER use synchronous firewall restart over SSH when WAN rules change
NEVER assume PRIMARY_HOST is the only way to reach hosts
NEVER remove files you didn't deploy in cleanup
NEVER run modprobe -r for GPU drivers in broad-scope cleanup
NEVER shut down or crash hosts with wol_capable: false