Bascule d'instance (make instance-utiliser) + identité relative à l'inventaire
make instance-utiliser NOM=… repointe le symlink 'instance' (prod ↔ bac à sable) ; make instance-courante affiche le montage. Le panneau Intrants lit l'identité dans group_vars/all/10-intrants.yml de l'inventaire monté (réel ou symlink partagé), donc compatible avec la séparation par instance comme avec l'ancien partage lab/production. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0e7cefbb2f
commit
e57d2c265a
3 changed files with 27 additions and 5 deletions
|
|
@ -3,6 +3,15 @@
|
||||||
## 2026-06-30
|
## 2026-06-30
|
||||||
|
|
||||||
### Ajouté
|
### Ajouté
|
||||||
|
- **Bascule d'instance (`make instance-utiliser NOM=…`).** Repointe le symlink
|
||||||
|
`instance` vers un autre dépôt d'instance (prod ↔ bac à sable) ;
|
||||||
|
`make instance-courante` affiche l'instance montée. Permet d'exploiter plusieurs
|
||||||
|
instances (séparation **par instance**) depuis un seul moteur.
|
||||||
|
- **Identité des intrants relative à l'inventaire.** Le panneau « Intrants » lit/écrit
|
||||||
|
l'identité dans `group_vars/all/10-intrants.yml` de l'inventaire monté (fichier réel
|
||||||
|
pour une instance autonome, symlink vers une source partagée sinon — l'écriture suit
|
||||||
|
le symlink). Fonctionne donc aussi bien pour une instance « par instance » que pour
|
||||||
|
l'ancien partage lab/production.
|
||||||
- **Inventaire d'instance neutre et configurable (`principal` / `SETOPS_INVENTAIRE`).**
|
- **Inventaire d'instance neutre et configurable (`principal` / `SETOPS_INVENTAIRE`).**
|
||||||
Le moteur (Makefile + `inventory_gui`, `instancier`, `config_proxmox`, `serveurs`,
|
Le moteur (Makefile + `inventory_gui`, `instancier`, `config_proxmox`, `serveurs`,
|
||||||
`applications`) ne code plus en dur `inventories/lab` / `inventories/production` :
|
`applications`) ne code plus en dur `inventories/lab` / `inventories/production` :
|
||||||
|
|
|
||||||
14
Makefile
14
Makefile
|
|
@ -191,9 +191,21 @@ test:
|
||||||
.PHONY: verifier
|
.PHONY: verifier
|
||||||
verifier: lint test inventaire-verifier syntaxe
|
verifier: lint test inventaire-verifier syntaxe
|
||||||
|
|
||||||
.PHONY: inventaire hote-planifier hote-ajouter hote-groupes hote-afficher appliquer deployer deployer-groupe cloner-vm creer-vm config inventaire-ui inventaire-verifier inventaire-lister inventaire-graphe inventaire-hote inventaire-lab inventaire-production
|
.PHONY: inventaire hote-planifier hote-ajouter hote-groupes hote-afficher appliquer deployer deployer-groupe cloner-vm creer-vm config inventaire-ui inventaire-verifier inventaire-lister inventaire-graphe inventaire-hote inventaire-lab inventaire-production instance-utiliser instance-courante
|
||||||
inventaire: inventaire-production
|
inventaire: inventaire-production
|
||||||
|
|
||||||
|
# Bascule le symlink 'instance' vers un autre dépôt d'instance (séparation par
|
||||||
|
# instance : prod vs bac à sable). Ex. : make instance-utiliser NOM=OPS-Chezlepro-lab
|
||||||
|
instance-utiliser:
|
||||||
|
@if [[ -z "$(NOM)" ]]; then printf '%s\n' "Usage: make instance-utiliser NOM=<dossier-frère> (ex. OPS-Chezlepro-lab)"; exit 2; fi
|
||||||
|
@if [[ ! -d "../$(NOM)" ]]; then printf '%s\n' "Introuvable: ../$(NOM)"; exit 2; fi
|
||||||
|
@if [[ -e instance && ! -L instance ]]; then printf '%s\n' "Refus: 'instance' existe et n'est pas un symlink."; exit 2; fi
|
||||||
|
@rm -f instance && ln -s "../$(NOM)" instance
|
||||||
|
@printf 'instance -> %s\n' "$$(readlink instance)"
|
||||||
|
|
||||||
|
instance-courante:
|
||||||
|
@printf 'instance -> %s\n' "$$(readlink instance 2>/dev/null || echo '(non monté)')"
|
||||||
|
|
||||||
config:
|
config:
|
||||||
python3 scripts/config_proxmox.py
|
python3 scripts/config_proxmox.py
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,11 @@ FICHIER_DOMAINES = INSTANCE / "plan/domaines.yml"
|
||||||
FICHIER_SERVEURS = INSTANCE / "plan/serveurs.yml"
|
FICHIER_SERVEURS = INSTANCE / "plan/serveurs.yml"
|
||||||
|
|
||||||
# Intrants de base (panneau GUI). Cibles d'ecriture possedees par le GUI.
|
# Intrants de base (panneau GUI). Cibles d'ecriture possedees par le GUI.
|
||||||
# Identite : source UNIQUE partagee (symlink depuis group_vars/all/). Proxmox :
|
# Identite : group_vars/all/10-intrants.yml de l'inventaire. Selon l'instance c'est
|
||||||
# group_vars de l'inventaire modele, cles gerees mises a jour, autres preservees.
|
# un fichier reel (modele « par instance ») ou un symlink vers une source partagee
|
||||||
# Les SECRETS n'y entrent jamais.
|
# (ecrire suit le symlink). Proxmox : group_vars de l'inventaire modele. Les SECRETS
|
||||||
INTRANTS_IDENTITE = INSTANCE / "inventories/partage/intrants-identite.yml"
|
# n'y entrent jamais.
|
||||||
|
INTRANTS_IDENTITE = INVENTAIRE_DEFAUT.parent / "group_vars/all/10-intrants.yml"
|
||||||
INTRANTS_PROXMOX = INVENTAIRE_MODELE.parent / "group_vars/proxmox.yml"
|
INTRANTS_PROXMOX = INVENTAIRE_MODELE.parent / "group_vars/proxmox.yml"
|
||||||
FICHIERS_INTRANTS = {"identite": INTRANTS_IDENTITE, "proxmox": INTRANTS_PROXMOX}
|
FICHIERS_INTRANTS = {"identite": INTRANTS_IDENTITE, "proxmox": INTRANTS_PROXMOX}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue