#!/usr/bin/env python3 import sys from pathlib import Path def setup(): print("=== Configuration du déploiement Traefik ===\n") server_ip = input("IP du serveur de production: ").strip() if not server_ip: print("❌ IP requise") sys.exit(1) ssh_key = input("Clé SSH [~/.ssh/id_rsa]: ").strip() if not ssh_key: ssh_key = str(Path.home() / ".ssh" / "id_rsa") ssh_key_path = Path(ssh_key).expanduser() if not ssh_key_path.exists(): print(f"❌ Clé SSH introuvable: {ssh_key_path}") sys.exit(1) ssh_user = input("Utilisateur SSH [root]: ").strip() or "root" letsencrypt_email = input("Email Let's Encrypt: ").strip() if not letsencrypt_email: print("❌ Email requis") sys.exit(1) traefik_version = input("Version Traefik [v3.2.0]: ").strip() or "v3.2.0" inventory_content = f"""[traefik_servers] traefik_prod ansible_host={server_ip} ansible_user={ssh_user} ansible_ssh_private_key_file={ssh_key_path} [traefik_servers:vars] ansible_python_interpreter=/usr/bin/python3 letsencrypt_email={letsencrypt_email} traefik_version={traefik_version} forgejo_url=http://eregion.chezlepro.ca:3000 forgejo_owner=Chezlepro forgejo_repo=traefik-deploy """ Path("inventory.ini").write_text(inventory_content) print(f"\n✓ Configuration créée: inventory.ini") print("\nProchaines étapes:") print(" make test-connection") print(" make build-forgejo") print(" make deploy") if __name__ == "__main__": setup()