minfra-v2 — DR Bootstrap Full
Orchestrateur Disaster Recovery : reconstruit toute l’infra minfra-v2 à partir d’un état zéro (Proxmox neuf, NAS neuf, aucune VM) jusqu’à services Docker up et dashboard vision accessible. 9 étapes chaînées, chacune idempotente avec auto-skip si déjà OK.
Contexte
Objectif: une commande unique pour reconstruire minfra-v2 après:
- Crash matériel coruscant / jedha
- Wipe volontaire pour test DR
- Reboot post-incident (récupère état dégradé)
Idempotence garantie: chaque sous-task vérifie l’état actuel et skip si déjà en place. Re-run safe à tout moment.
Hypothèses pré-bootstrap:
- Hardware up (Proxmox coruscant 10.0.1.30, NAS jedha 10.0.1.20)
- Réseau OPNsense pas requis (on le construit dans l’étape 4-5)
- Naboo (WSL Ubuntu) avec : SSH key minfra, age key SOPS, mise/task/ansible/terraform/packer/sops/age installés (
task 00-prerequis-contexte) - Box SFR forward 443/80 → 192.168.1.2 (OPNsense WAN)
Lancer le DR
task minfra:bootstrap
Durée:
- From scratch (rien existant) : ~45-60 min (gros = builds Packer 15-20 min chacun)
- Re-run (déjà déployé, idempotent skip) : ~3-5 min (juste les checks)
Les 9 étapes orchestrées
| # | Étape | Skip si | Durée |
|---|---|---|---|
| 1 | Proxmox coruscant setup | SSH key OK + bootstrap idempotent | ~2 min |
| 2 | NAS jedha (structure + NFS) | SSH OK + dirs présents | ~1 min |
| 3 | Packer templates (debian12 + opnsense26) | VM 9100/9200 existent + template:1 | 0 (skip) ou ~35 min (build) |
| 4 | Terraform VMs (opnsense 200 + tatooine 130 + kamino 131 + kalevala 132) | VM existe (TF state) | ~2 min/VM |
| 5 | OPNsense config smart | (cf 7 étapes auto-skip de opnsense:config) | ~30 sec à 2 min |
| 6 | NFS mount → tatooine | déjà monté | ~10 sec |
| 7 | Platform Docker tatooine (step-ca + Traefik + Authentik + Vaultwarden + vision) | stack up | ~2 min |
| 8 | Vision deploy (dashboard) | image up | ~3 min |
| 9 | Postcheck global | toujours (verif) | ~10 sec |
Postcheck global
task minfra:postcheck
Vérifie sans changer:
- SSH coruscant + jedha
- NAS NFS port 2049
- OPNsense LAN SSH + GUI + API
- Docker tatooine (count containers up via bastion OPNsense)
- Traefik endor direct
- Site public
mariage-as.sta4ck.eu - DNS Unbound interne
*.minfra.in(8 hosts)
Output coloré, compteurs Succès / Alertes / Erreurs + ✨ SUCCÈS ou ❌ ÉCHEC.
Convention output
Tous les scripts smart partagent la lib infra/ansible/scripts/_lib_output.sh:
╔════════════════════════════════════╗
║ TITRE ║
╚════════════════════════════════════╝
╭── [N/M] SECTION ─────────
│ ✔ OK message
│ ⏩ SKIP message
│ ⚠ Warning
│ ✖ Fail
│ ▶ Run action
│ ℹ Info
╰──────────────────────────────
RÉSUMÉ
────────────────────
Durée : 4m 23s
Succès : 12
Alertes : 1
Erreurs : 0
✨ SUCCÈS
Reprise après échec
Si étape N plante : fix le problème, relance task minfra:bootstrap.
Les étapes 1 à N-1 skip auto (idempotent). Reprise au point d’arrêt.
Exemples cas réels:
- Étape 3 (Packer) plante : check VM existante coruscant
qm list, kill si zombie, relance - Étape 5 (OPNsense config) plante : cf logs Ansible, fix XML/role, relance
- Étape 7 (Docker tatooine) plante : check storage NFS (étape 6), check Traefik logs
Tâches granulaires (debug isolé)
Si tu veux re-jouer UNE étape spécifique:
task proxmox:setup # étape 1 seule
task nas:setup # étape 2 seule
task opnsense:template:deploy # rebuild template 9200 seul (DESTROY existing)
task opnsense:config # étape 5 seule
task platform:docker DOCKER_HOST=tatooine # étape 7 seule
task vision:deploy # étape 8 seule
task minfra:postcheck # étape 9 seule
Tâches deprecated absorbées
Plus dans le menu user (toujours dispo via ansible:*):
opnsense:bootstrap→ absorbé paropnsense:configopnsense:gen-apikey→ idemopnsense:switchover→ template Packer set direct IPs prodnas:bootstrap+nas:structure:verify+nas:nfs:setup→nas:setupproxmox:init-ssh→proxmox:setup
Hors périmètre
- GitLab (
task gitlab:setup) — pas dans bootstrap automatique car VM kamino spécifique. Lancer après si besoin:task gitlab:setup - HA OPNsense (CARP) — phase 2, secondaire sur kalevala
- Multi-site DR (offsite backup) — phase 2, replication NAS cron
- k3s cluster (L9) — différé après stabilisation