Initial commit: MAAS-deployable Proxmox VE images with cluster automation

Builds a Proxmox VE image that MAAS can deploy to bare metal, plus first-boot
automation that configures the node and joins it to a Proxmox cluster with no
manual steps.

The image starts from the official Debian cloud image and installs proxmox-ve
on top of it, rather than capturing a raw disk from the Proxmox ISO. That keeps
MAAS in control of partitioning, networking, SSH keys and cloud-init, and makes
moving between Proxmox releases a variable change instead of a rewrite.

Contents:

  * Makefile driving the whole flow: build, verify, preseed, upload
  * customize-proxmox.sh, run inside the Packer build VM, which layers Proxmox
    onto the Debian cloud image and resets the pmxcfs node identity so one image
    can produce many nodes
  * pve-maas-init, a first-boot state machine covering /etc/hosts, node-unique
    identifiers, the root password, vmbr0 conversion, cluster create/join and
    the local-lvm thin pool; each stage is resumable across reboots
  * curtin-hooks, which stops curtin installing a kernel over APT and pins
    interface names by MAC so they match what MAAS recorded at commissioning
  * a MAAS curtin preseed template and cloud-init examples
  * deploy-cluster.sh, which builds a whole cluster through the MAAS API
  * verify-image.sh, 22 static checks on the produced tarball

Cluster identity lives entirely in deploy-time cloud-init user-data, so a single
image and preseed can build any number of independent clusters.

Verified end to end against MAAS 3.7.2: proxmox-ve 9.2.0 / pve-manager 9.2.11 /
kernel 7.0.14-15-pve, deployed to two machines that formed a quorate cluster with
local-lvm on both, with no manual intervention.

The README documents four failure modes found along the way that all fail
silently: curtin rejecting "kernel: null", pvenetcommit overwriting the network
configuration at boot, interface renaming leaving the link down, and a systemd
ordering cycle that made systemd delete the service's start job.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-04 21:50:17 +02:00
commit 3d4841f31c
18 changed files with 3395 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
# /etc/pve-maas/pve-maas.conf
#
# pve-maas-init varsayilan yapilandirmasi. BU DOSYAYI DUZENLEMEYIN.
# Dugume ozel ayarlari MAAS deploy sirasinda cloud-init ile
# /etc/pve-maas/conf.d/*.conf altina yazin; oradaki degerler bunlari ezer.
#
# Ornek (cloud-init user-data):
# write_files:
# - path: /etc/pve-maas/conf.d/50-cluster.conf
# permissions: "0600"
# content: |
# PVE_ROOT_PASSWORD='...'
# PVE_CLUSTER_MODE=join
# PVE_CLUSTER_PEER=192.0.2.11
# PVE_CLUSTER_PEER_PASSWORD='...'
# ---------------------------------------------------------------- genel
# Tum ilk acilis otomasyonunu kapatmak icin false yapin.
PVE_ENABLED=true
# Bos birakilirsa hostname -f / resolv.conf'tan turetilir.
PVE_FQDN=
# ---------------------------------------------------------------- ag
# MAAS'in yapilandirdigi arayuz vmbr0 koprusune donusturulsun mu?
# Bond/VLAN gibi karmasik topolojilerde false yapip /etc/network/interfaces
# dosyasini cloud-init ile kendiniz yazin.
PVE_NET_MANAGE=true
PVE_NET_BRIDGE=vmbr0
# Bos ise varsayilan rotayi tasiyan arayuz kullanilir.
PVE_NET_UPLINK=
# auto | static | dhcp (auto: MAAS'in yazdigi yapilandirmadan tespit edilir)
PVE_NET_MODE=auto
# reboot | reload | none
# reboot : yapilandirmayi yazip bir kez yeniden baslatir (en guvenilir)
# reload : ifreload -a ile canli uygular (yeniden baslatma yok)
# none : sadece yazar, uygulamaz
PVE_NET_APPLY=reboot
# Koprude VLAN farkindaligi (bridge-vlan-aware yes, vids 2-4094)
PVE_NET_VLAN_AWARE=false
# /etc/network/interfaces sonuna eklenecek ham metin (ek kopruler vb.)
PVE_NET_EXTRA=
# ---------------------------------------------------------------- root parolasi
# root@pam web arayuzu girisi ve baska dugumlerin bu dugume katilmasi icin gerekli.
# Duz metin yerine hash tercih edin: openssl passwd -6
PVE_ROOT_PASSWORD=
PVE_ROOT_PASSWORD_HASH=
# ---------------------------------------------------------------- kume
# none | create | join
PVE_CLUSTER_MODE=none
# create icin
PVE_CLUSTER_NAME=
# join icin: mevcut bir kume dugumunun IP/hostname'i ve root@pam parolasi
PVE_CLUSTER_PEER=
PVE_CLUSTER_PEER_PASSWORD=
PVE_CLUSTER_PEER_PASSWORD_FILE=
# Sertifika parmak izi. Bos ve DISCOVER=true ise dugumden okunur (TOFU).
# Guvenlik icin degeri onceden vermeniz onerilir:
# openssl s_client -connect NODE:8006 </dev/null 2>/dev/null | \
# openssl x509 -noout -fingerprint -sha256 | cut -d= -f2
PVE_CLUSTER_FINGERPRINT=
PVE_CLUSTER_FINGERPRINT_DISCOVER=true
# Corosync baglantilari (ayri bir kume agi kullaniyorsaniz)
PVE_CLUSTER_LINK0=
PVE_CLUSTER_LINK1=
PVE_CLUSTER_NODEID=
PVE_CLUSTER_VOTES=
# Kume dugumunun erisilebilir olmasi icin beklenecek sure (saniye) ve deneme sayisi
PVE_CLUSTER_WAIT=900
PVE_CLUSTER_RETRIES=5
# Katilimdan sonra conf.d icindeki parolalari sil
PVE_CLUSTER_WIPE_SECRETS=true
# ---------------------------------------------------------------- depolama
# auto | off | <vg-adi>
# auto: en cok bos alani olan VG secilir
PVE_THINPOOL=auto
PVE_THINPOOL_NAME=data
PVE_THINPOOL_STORAGE=local-lvm
PVE_THINPOOL_MIN_GB=16
# Ayri bir disk verilirse o diskten yeni bir VG olusturulur.
PVE_THINPOOL_DISK=
PVE_THINPOOL_VG=pve