Skip to content

Host management (community-scripts)

The interactive community-scripts Host Management tools, turned into unattended, idempotent Ansible. Nothing asks questions, every run converges to the same state, and every tool can be switched off per node or group.

ansible-playbook playbooks/host_management.yml --check --diff     # what would change
ansible-playbook playbooks/host_management.yml                    # apply
ansible-playbook playbooks/host_management.yml --tags repos       # repos | microcode | tools

It is part of site.yml, so it runs unattended on every deploy (push to main) and converges again each time. Alone: Actions → deploy → Run workflow → host_management.yml.

community-script Where Role What Ansible does
post-pve-install PVE nodes proxmox_post_install deb822 debian.sources (+ non-free-firmware), legacy Debian/Proxmox *.list renamed to .bak, pve-enterprise + Ceph enterprise Enabled: false, pve-no-subscription, Ceph no-subscription for the installed Ceph release, pve-test (disabled), subscription nag removed + apt hook
post-pdm-install proxmox-datacenter-manager (CT 125) proxmox_post_install same for PDM (pdm-no-subscription, pdm-test), PDM nag patch
post-pmg-install proxmox-mail-gateway (CT 130) proxmox_post_install same for PMG (pmg-no-subscription, pmgtest)
microcode PVE nodes host_microcode intel-microcode + iucode-tool or amd64-microcode from Debian, kept current by apt
pbs-microcode PBS on bare metal host_microcode same; the PBS LXC on node08 is skipped (containers use the host's microcode). pbs01 (10.0.0.14) is managed: false - give Ansible SSH access and set managed: true to include it
scaling-governor PVE nodes pve_host_tools cpu-governor.service sets pve_governor (default powersave) at boot; skipped where the CPU lacks it
kernel-clean PVE nodes pve_host_tools pve-kernel-clean: purges old proxmox-kernel-*, keeps the running, pinned and newest 2; weekly timer (Sun 05:30) + once per run. Refuses if apt would remove anything else
disk-health PVE nodes pve_host_tools smartmontools + nvme-cli, smartd self-tests (short daily 02:00, long Sat 03:00), disk-health report command, smartctl_exporter :9633 → Prometheus job smartctl, alerts Disk*, Grafana dashboard 22604
monitor-all PVE nodes pve_host_tools upstream ping-instances.sh + ping-instances.service
add-iptag PVE nodes pve_host_tools upstream iptag program in /opt/iptag, config from pve_iptag_*, iptag.service
pve-ups CT 102 pve-ups on node08 app catalog was mapped to NUT (tcp/3493); now its own app: probe /api/health, Traefik route + DNS pve-ups.home.janwiebe.eu, NetBox service, nightly update-apps

Left out on purpose from the post-install scripts: dist-upgrade (that is upgrade_all.yml), HA on/off (the cluster keeps what it has) and the reboot.

Monitor-All and iptag ship their program as a heredoc inside the installer. The role downloads the installer on every run, cuts the program out and deploys it, so the nodes run the current upstream code. If upstream changes that layout, the run stops with an assert instead of deploying garbage.

Settings

roles/pve_host_tools/defaults/main.yml, roles/proxmox_post_install/defaults/main.yml, roles/host_microcode/defaults/main.yml. Override in inventory/group_vars/proxmox_nodes/main.yml or host_vars/<node>.yml, for example:

pve_governor: performance          # on the GPU nodes
pve_kernel_keep: 3
pve_monitor_all_exclude: {node05: [128]}
pve_iptag_enabled: false           # per node
ppi_test_repo: false

Monitor-All: which guests

Only guests with onboot: 1 and the tag mon-restart are watched (every 5 minutes):

  • LXC: 3 pings (and once more after 5 s); no answer → pct stop + pct start
  • VM: qm guest cmd <id> ping (needs the QEMU guest agent); no answer → qm stop + qm start
  • a stopped tagged guest is started

Add the tag in the Proxmox UI or pct set <id> --tags "$(pct config <id> | awk '/^tags:/{print $2}');mon-restart". Log: /var/log/ping-instances.log. Stop it before maintenance on a tagged guest: systemctl stop ping-instances.

IP tags

Every LXC/VM gets its IP (pve_iptag_cidrs, default the home LAN 10.0.0.0/16) as a Proxmox tag, updated every 5 minutes. The Proxmox inventory turns tags into groups, so tag_10_0_3_177 style groups appear; nothing in this repo uses them. One manual pass: iptag-run.

Checks on a node

disk-health                         # SMART report of every disk (exit 1 if one is not PASSED)
disk-health --test sda              # + start a short self-test
journalctl -u smartmontools         # smartd findings
curl -s localhost:9633/metrics | grep smart_status
pve-kernel-clean --dry-run          # kernels that would go
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
journalctl -k | grep -m1 microcode  # microcode revision after a reboot
systemctl status iptag ping-instances