diff --git a/inventories/production/group_vars/clients_pki.yml b/inventories/production/group_vars/clients_pki.yml deleted file mode 100644 index 472a99a..0000000 --- a/inventories/production/group_vars/clients_pki.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -# Conformite PKI cliente (tout hote devant une identite machine). - -client_pki_ca_url: "https://infra-pki-01.chezlepro.internal:8443" -client_pki_provisioner: "admin@chezlepro.internal" - -# Secrets OBLIGATOIRES, a fournir via Ansible Vault avant tout deploiement reel : -# client_pki_ca_fingerprint: "{{ vault_step_ca_fingerprint }}" -# client_pki_provisioner_password: "{{ vault_step_ca_provisioner_password }}" -# Le provisioner password est PARTAGE avec serveur_step_ca : le placer dans un -# vault partage (ex. group_vars/all/) lisible par les deux groupes. diff --git a/inventories/production/group_vars/serveurs_icinga.yml b/inventories/production/group_vars/serveurs_icinga.yml deleted file mode 100644 index b45cab7..0000000 --- a/inventories/production/group_vars/serveurs_icinga.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# Conformite supervision Icinga (mon-01, VLAN 14). - -serveur_icinga_db_host: "10.1.13.11" # data-01 (serveur_postgresql) - -# Secret BD OBLIGATOIRE, a fournir via Ansible Vault (partage avec serveur_postgresql) : -# vault_bd_icingadb: "..." -# A placer dans un vault partage (ex. group_vars/all/) lisible par les deux groupes. diff --git a/inventories/production/group_vars/serveurs_keycloak.yml b/inventories/production/group_vars/serveurs_keycloak.yml deleted file mode 100644 index c8b62c4..0000000 --- a/inventories/production/group_vars/serveurs_keycloak.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -# Conformite Keycloak (idm-01, VLAN 12). - -serveur_keycloak_hostname: "keycloak.chezlepro.internal" -serveur_keycloak_db_host: "10.1.13.11" # data-01 (serveur_postgresql) - -# Secrets OBLIGATOIRES, a fournir via Ansible Vault avant tout deploiement reel : -# - serveur_keycloak_admin_password: "{{ vault_keycloak_admin }}" (admin bootstrap) -# - vault_bd_keycloak: "..." (mot de passe BD, partage avec serveur_postgresql) -# Convertir en dossier group_vars/serveur_keycloak/ avec main.yml (clair) + vault.yml (chiffre). -# Le secret BD (vault_bd_keycloak) doit etre lisible aussi par serveur_postgresql -# (placer dans un vault partage, ex. group_vars/all/). diff --git a/inventories/production/group_vars/serveurs_nginx.yml b/inventories/production/group_vars/serveurs_nginx.yml deleted file mode 100644 index 641b98c..0000000 --- a/inventories/production/group_vars/serveurs_nginx.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# Conformite nginx / edge (infra-edge-01, VLAN 11). - -# Sites de reverse proxy : a declarer ici quand un service web doit etre publie. -# L'amont pointe vers l'IP interne et le port du service (cf. nomenclature). -serveur_nginx_sites: [] -# - nom: forge -# domaine: forge.chezlepro.internal -# amont: "http://10.1.15.11:3000" diff --git a/inventories/production/group_vars/serveurs_redis.yml b/inventories/production/group_vars/serveurs_redis.yml deleted file mode 100644 index 7e9dadb..0000000 --- a/inventories/production/group_vars/serveurs_redis.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# Conformite Redis (data-01, VLAN 13). - -serveur_redis_maxmemory: "256mb" - -# Secret OBLIGATOIRE, a fournir via Ansible Vault avant tout deploiement reel : -# serveur_redis_password: "{{ vault_redis }}" -# Convertir en dossier group_vars/serveur_redis/ avec main.yml + vault.yml (chiffre). diff --git a/inventories/production/group_vars/serveurs_step_ca.yml b/inventories/production/group_vars/serveurs_step_ca.yml deleted file mode 100644 index a5247c4..0000000 --- a/inventories/production/group_vars/serveurs_step_ca.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# Conformite AC interne step-ca (infra-pki-01, VLAN 11). - -serveur_step_ca_nom: "Chezlepro Internal CA" -serveur_step_ca_adresse: ":8443" -serveur_step_ca_acme: true - -# Secrets OBLIGATOIRES, a fournir via Ansible Vault avant tout deploiement reel. -# Convertir ce fichier en dossier group_vars/serveur_step_ca/ avec : -# main.yml (en clair) : -# serveur_step_ca_password: "{{ vault_step_ca_password }}" -# serveur_step_ca_provisioner_password: "{{ vault_step_ca_provisioner_password }}" -# vault.yml (chiffre ansible-vault) : -# vault_step_ca_password: "..." -# vault_step_ca_provisioner_password: "..." -# Tant qu'ils sont absents, le role refuse de s'executer (assertion explicite). diff --git a/playbooks/groupes/clients_journaux.yml b/playbooks/groupes/clients_journaux.yml deleted file mode 100644 index 6e8b30b..0000000 --- a/playbooks/groupes/clients_journaux.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Appliquer le groupe client_journal - hosts: client_journal - become: true - gather_facts: true - - pre_tasks: - - name: Vérifier que la cible est Debian - ansible.builtin.assert: - that: - - ansible_facts.distribution == "Debian" - fail_msg: "Ce playbook est prévu pour Debian." - - roles: - - client_journal diff --git a/playbooks/groupes/clients_ldap.yml b/playbooks/groupes/clients_ldap.yml deleted file mode 100644 index db053a0..0000000 --- a/playbooks/groupes/clients_ldap.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Appliquer le groupe client_ldap - hosts: client_ldap - become: true - gather_facts: true - - pre_tasks: - - name: Vérifier que la cible est Debian - ansible.builtin.assert: - that: - - ansible_facts.distribution == "Debian" - fail_msg: "Ce playbook est prévu pour Debian." - - roles: - - client_ldap diff --git a/playbooks/groupes/serveurs_collabora.yml b/playbooks/groupes/serveurs_collabora.yml deleted file mode 100644 index fa02013..0000000 --- a/playbooks/groupes/serveurs_collabora.yml +++ /dev/null @@ -1,10 +0,0 @@ ---- -- name: Appliquer le groupe serveur_collabora - hosts: serveur_collabora - become: true - gather_facts: true - - tasks: - - name: Indiquer que le service Collabora reste à définir - ansible.builtin.debug: - msg: "Aucun rôle n'est encore associé au groupe serveur_collabora." diff --git a/playbooks/groupes/serveurs_grafana.yml b/playbooks/groupes/serveurs_grafana.yml deleted file mode 100644 index f424761..0000000 --- a/playbooks/groupes/serveurs_grafana.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Appliquer le groupe serveur_grafana - hosts: serveur_grafana - become: true - gather_facts: true - - pre_tasks: - - name: Vérifier que la cible est Debian - ansible.builtin.assert: - that: - - ansible_facts.distribution == "Debian" - fail_msg: "Ce playbook est prévu pour Debian." - - roles: - - serveur_grafana diff --git a/playbooks/groupes/serveurs_icinga.yml b/playbooks/groupes/serveurs_icinga.yml deleted file mode 100644 index badb998..0000000 --- a/playbooks/groupes/serveurs_icinga.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Appliquer le groupe serveur_icinga - hosts: serveur_icinga - become: true - gather_facts: true - - pre_tasks: - - name: Vérifier que la cible est Debian - ansible.builtin.assert: - that: - - ansible_facts.distribution == "Debian" - fail_msg: "Ce playbook est prévu pour Debian." - - roles: - - serveur_icinga diff --git a/playbooks/groupes/serveurs_openldap.yml b/playbooks/groupes/serveurs_openldap.yml deleted file mode 100644 index 3194780..0000000 --- a/playbooks/groupes/serveurs_openldap.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Appliquer le groupe serveur_openldap - hosts: serveur_openldap - become: true - gather_facts: true - - pre_tasks: - - name: Vérifier que la cible est Debian - ansible.builtin.assert: - that: - - ansible_facts.distribution == "Debian" - fail_msg: "Ce playbook est prévu pour Debian." - - roles: - - serveur_openldap diff --git a/playbooks/groupes/serveurs_postgresql.yml b/playbooks/groupes/serveurs_postgresql.yml deleted file mode 100644 index c8491e2..0000000 --- a/playbooks/groupes/serveurs_postgresql.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Appliquer le groupe serveur_postgresql - hosts: serveur_postgresql - become: true - gather_facts: true - - pre_tasks: - - name: Vérifier que la cible est Debian - ansible.builtin.assert: - that: - - ansible_facts.distribution == "Debian" - fail_msg: "Ce playbook est prévu pour Debian." - - roles: - - serveur_postgresql diff --git a/scripts/applications (conflicted copy 2026-06-23 231110).py b/scripts/applications (conflicted copy 2026-06-23 231110).py deleted file mode 100644 index b9794cc..0000000 --- a/scripts/applications (conflicted copy 2026-06-23 231110).py +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env python3 -"""Lit et valide le registre des applications Set-OPS (docs/applications.yml).""" - -from __future__ import annotations - -import argparse -import sys -from pathlib import Path - -import yaml - -from inventory_gui import charger_yaml, liste_hotes -from inventory_rules import ( - bases_de_application, - chaine_connexion, - charger_applications, - charger_bases_donnees, - charger_domaines, - valider_applications, -) - -RACINE = Path(__file__).resolve().parents[1] -FICHIER = RACINE / "docs/applications.yml" -FICHIER_BASES = RACINE / "docs/bases-donnees.yml" -FICHIER_DOMAINES = RACINE / "docs/domaines.yml" -INVENTAIRE = RACINE / "inventories/production/hosts.yml" - -# Groupes 'serveurs_*' qui sont des capacites de SOCLE (sur toutes les VM), -# pas des applications a part entiere. -GROUPES_SOCLE = {"serveur_debian", "serveur_durci"} - - -def _liste(valeur: str) -> list: - return [v.strip() for v in (valeur or "").split(",") if v.strip()] - - -def ecrire(registre: dict) -> None: - entete = ( - "# Registre des applications Set-OPS (application = entite pivot).\n" - "# Edite par make inventaire-ui ou scripts/applications.py.\n" - "# Une VM peut porter plusieurs applications ; une base se lie a une application.\n" - "---\n" - ) - with FICHIER.open("w", encoding="utf-8") as fichier: - fichier.write(entete) - yaml.safe_dump({"applications": registre.get("applications", {}) or {}}, - fichier, default_flow_style=False, sort_keys=False, allow_unicode=True) - - -def lister(registre: dict, bases: dict) -> None: - apps = registre.get("applications", {}) - if not apps: - print("Aucune application declaree.") - return - for nom, app in apps.items(): - extras = [] - if app.get("port"): - extras.append(f"port {app['port']}") - if app.get("requiert"): - extras.append(f"requiert {', '.join(app['requiert'])}") - if app.get("expose"): - extras.append(f"expose {', '.join(app['expose'])}") - suffixe = (" {" + " ; ".join(extras) + "}") if extras else "" - print(f"{nom} [groupe {app.get('groupe', '?')}, hote {app.get('hote', '?')}]{suffixe}") - for entree in bases_de_application(bases, application=nom, - groupe=app.get("groupe"), hote=app.get("hote")): - base = entree["base"] - portee = base.get("portee", "groupe") - print(f" DSN ({portee}/{base.get('usage', '-')}): {chaine_connexion(base, entree['serveur'])}") - - -def bootstrap(registre_existant: dict) -> dict: - """(Re)genere les applications depuis les appartenances de groupes de l'inventaire. - - Un groupe 'serveurs_*' (hors socle) sur un hote = une application. Les entrees - existantes correspondant a un couple (groupe, hote) toujours present sont - preservees telles quelles (port / expose / requiert ...). - """ - existant = registre_existant.get("applications") or {} - par_cle = {(a.get("groupe"), a.get("hote")): (cle, a) for cle, a in existant.items()} - apps: dict = {} - for h in liste_hotes(charger_yaml(INVENTAIRE)): - hote = h.get("nom") - if not hote: - continue - for groupe in sorted(h.get("groupes", [])): - if not groupe.startswith("serveur_") or groupe in GROUPES_SOCLE: - continue - garde = par_cle.get((groupe, hote)) - if garde: - apps[garde[0]] = garde[1] - continue - base = groupe[len("serveur_"):] - app_id = base if base not in apps else f"{base}-{hote}" - apps[app_id] = {"groupe": groupe, "hote": hote} - return {"applications": apps} - - -def main() -> int: - parser = argparse.ArgumentParser(description="Registre des applications Set-OPS.") - sub = parser.add_subparsers(dest="commande", required=True) - sub.add_parser("lister", help="Affiche les applications et leurs DSN resolus.") - sub.add_parser("verifier", help="Valide la coherence du registre.") - sub.add_parser("bootstrap", help="(Re)genere applications.yml depuis les groupes de l'inventaire.") - - pa = sub.add_parser("ajouter", help="Ajoute ou met a jour une application.") - pa.add_argument("--id", required=True) - pa.add_argument("--groupe", required=True) - pa.add_argument("--hote", required=True) - pa.add_argument("--port", type=int) - pa.add_argument("--requiert", default="", help="Applications dont elle depend (separees par virgule).") - pa.add_argument("--expose", default="", help="FQDN publics qui la publient (separes par virgule).") - - pr = sub.add_parser("retirer", help="Retire une application.") - pr.add_argument("--id", required=True) - - args = parser.parse_args() - try: - registre = charger_applications(FICHIER) - domaines = charger_domaines(FICHIER_DOMAINES) - if args.commande == "lister": - lister(registre, charger_bases_donnees(FICHIER_BASES)) - elif args.commande == "verifier": - valider_applications(registre, domaines) - print("Registre des applications valide.") - elif args.commande == "bootstrap": - registre = bootstrap(registre) - valider_applications(registre, domaines) - ecrire(registre) - print(f"docs/applications.yml genere depuis l'inventaire ({len(registre['applications'])} applications).") - elif args.commande == "ajouter": - app = {"groupe": args.groupe, "hote": args.hote} - if args.port is not None: - app["port"] = args.port - if _liste(args.requiert): - app["requiert"] = _liste(args.requiert) - if _liste(args.expose): - app["expose"] = _liste(args.expose) - registre["applications"][args.id] = app - valider_applications(registre, domaines) - ecrire(registre) - print(f"Application '{args.id}' enregistree.") - elif args.commande == "retirer": - registre["applications"].pop(args.id, None) - valider_applications(registre, domaines) - ecrire(registre) - print(f"Application '{args.id}' retiree.") - except Exception as exc: - print(f"erreur: {exc}", file=sys.stderr) - return 2 - return 0 - - -if __name__ == "__main__": - raise SystemExit(main())