Template Debian 12 — build Packer
Étape 3a du DR bootstrap. Build template VM 9100 sur coruscant. Reproductible, bake Docker + cloud-init + NFS mount → VMs Debian deployables en ~30s par Terraform.
Contexte
Output: template Proxmox template-debian12 (VM ID 9100). Utilisé par Terraform
pour cloner toutes les VMs Debian de minfra-v2 (tatooine, kamino, kalevala).
Stratégie: preseed.cfg auto-installé via HTTP serveur Packer + cloud-init post-install. Aucune intervention manuelle.
Baked inside:
- Debian 12 minimal + sshd + ansible user (clé minfra)
- Docker CE + docker compose plugin
- NFS client + auto-mount jedha:/volume1/data → /mnt/nas
- mise (versions outillage si besoin)
- qemu-guest-agent (pour Proxmox IP detection)
Prérequis
- Proxmox coruscant up + token API packer (cf
04-proxmox-setup) - NAS jedha up + ISO debian12 dans
jedha-data:iso/(cf05-nas-jedha-setup) - Naboo : packer + sops + age installés (cf
02-prerequis-contexte) - SOPS
infra/packer/secrets/proxmox.yamlchiffré
Précheck
# Verif ISO presente sur coruscant
ssh -i ~/.ssh/id_ed25519_minfra root@10.0.1.30 'ls /mnt/pve/jedha-data/template/iso/debian-12*.iso'
# Verif token SOPS dechiffrable
cd /mnt/d/git/minfra-v2/infra/packer
sops -d secrets/proxmox.yaml | grep -q packer_token
Build
task debian12:template:deploy
Durée ~20 min. Phases :
- Auto-clean VM 9100 si existe
- Crée VM vide sur coruscant
- Boot ISO + preseed.cfg via HTTP Packer (naboo:8275)
- Install Debian 12 auto (10 min)
- SSH + post-install (Docker, NFS, mise) ~5 min
- Cleanup + convert VM → template
Verify: ssh root@10.0.1.30 ‘qm config 9100 | grep “^template:“‘
Si build plante
task debian12:template:destroy # détruit VM 9100 partielle
task debian12:template:deploy # relance from scratch
Test du template
Le test = cloner une VM throwaway:
task debian12:vm:deploy NAME=test-vm IP=10.0.2.99
# Verif
ssh -o ProxyJump=root@10.0.1.1 packer@10.0.2.99 '
hostname; docker --version; df -h /mnt/nas
'
task debian12:vm:destroy NAME=test-vm
Variables clés
infra/packer/debian12/variables.pkrvars.hcl:
vm_id = 9100iso_storage_pool = "jedha-data"proxmox_node = "coruscant"storage_pool = "local-lvm"
Hors périmètre
- Template Ubuntu — pas utilisé, Debian suffit
- Template Alma/Rocky — pas utilisé
- Image cloud-init officielle — possible alternative mais moins de contrôle (Docker pas baked → install à chaque clone)
- Sysprep generalize — pas pertinent FreeBSD/Linux