Commit graph

31 commits

Author SHA1 Message Date
Tellsanguis
4628fc266f feat(cicd): Use Proxmox API instead of SSH for LINSTOR management
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 16s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 16s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 14s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 1m56s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
Version 2.0 du script de gestion LINSTOR

Changements majeurs:
- Remplace les commandes SSH/LINSTOR par l'API Proxmox REST
- Ajoute une classe ProxmoxAPI pour gérer les appels API
- Utilise les endpoints /cluster/linstor/* de l'API Proxmox
- Installe les dépendances Python (requests, urllib3) dans le pipeline
- Passe les credentials API via variables d'environnement/secrets
- Plus sécurisé: pas besoin de clés SSH, utilise les tokens API existants
- Support des certificats auto-signés (verify_ssl=False)

Auteur: BENE Maël
2025-11-27 12:51:08 +01:00
Tellsanguis
287410732f Revert "fix(cicd): Disable SSH host key verification for LINSTOR connections"
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 16s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 9s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 9s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 1m53s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
This reverts commit ddc9b1a98b.
2025-11-27 12:49:15 +01:00
Tellsanguis
ddc9b1a98b fix(cicd): Disable SSH host key verification for LINSTOR connections
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 9s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 8s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 1m53s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
- Ajoute -o StrictHostKeyChecking=no et -o UserKnownHostsFile=/dev/null
- Résout l'erreur 'Host key verification failed'
- Nécessaire car le container Docker n'a pas les clés d'hôtes enregistrées
2025-11-27 12:45:59 +01:00
Tellsanguis
6628870938 fix(cicd): Use IP address instead of hostname for LINSTOR host
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 16s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 8s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 8s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 1m54s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
- Replace 'thinkpad' with 192.168.100.30
- Docker containers cannot resolve local hostnames
- Résout l'erreur 'Could not resolve hostname thinkpad'
2025-11-27 12:44:56 +01:00
Tellsanguis
10e61edbc7 fix(cicd): Execute LINSTOR script in Docker container via SSH
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 8s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 8s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 1m53s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
- Modifie le script Python pour supporter l'exécution via SSH
- Ajoute paramètre --remote-host pour spécifier l'hôte LINSTOR
- Installe Python3 dans le container Docker (sans sudo)
- Le script s'exécute dans le container et communique avec LINSTOR via SSH
- Résout l'erreur 'sudo: command not found' dans les containers Docker
2025-11-27 12:41:39 +01:00
f33af51c4c Merge pull request 'feat: Automatisation gestion ressources LINSTOR et améliorations VMs' (#1) from feature/linstor-auto-resources into main
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 15s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 5s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 5s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 1m55s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
Reviewed-on: #1
2025-11-27 11:35:07 +00:00
Tellsanguis
2224c302c1 feat: Automatisation gestion ressources LINSTOR et améliorations VMs
All checks were successful
CI - Validation / Terraform Validation (push) Successful in 14s
CI - Validation / Ansible Validation (push) Successful in 1m3s
CI - Validation / Kubernetes Validation (push) Successful in 6s
CI - Validation / Security Scan (push) Successful in 13s
CI - Validation / Terraform Validation (pull_request) Successful in 13s
CI - Validation / Ansible Validation (pull_request) Successful in 1m3s
CI - Validation / Kubernetes Validation (pull_request) Successful in 7s
CI - Validation / Security Scan (pull_request) Successful in 13s
- Ajout script Python (v1.0) pour gestion automatique des ressources LINSTOR
  * Vérifie et crée les ressources si nécessaires
  * Redimensionne les volumes (augmentation uniquement)
  * Lecture automatique depuis fichiers Terraform
  * Opérations idempotentes

- Intégration dans pipeline CI/CD pour pve1 et pve2
  * Copie et exécution du script sur chaque noeud
  * Lecture dynamique de la config Terraform

- Améliorations configuration Terraform pour toutes les VMs
  * Ajout Standard VGA (résout "No Bootable Device")
  * Configuration CPU type "host" pour meilleures performances
  * BIOS et boot order explicites
  * Gestion VMs existantes (force_create approprié)
  * Lifecycle simplifié pour permettre mises à jour

Auteur script: BENE Maël
2025-11-27 12:31:26 +01:00
Tellsanguis
cc26fb97a6 fix(terraform): Set fixed VMID for VMs to prevent duplication
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 16s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 9s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 8s
CD - Deploy Infrastructure / Deploy on pve3 (push) Failing after 8s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
Assign specific VMID to each VM:
- k3s-server-1: 1000
- k3s-server-2: 1001
- etcd-witness: 1002
2025-11-26 19:41:52 +01:00
Tellsanguis
42be2b3b6b fix(terraform): Configure cluster nodes and storage
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 1m4s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 2m26s
CD - Deploy Infrastructure / Deploy on pve3 (push) Failing after 1m47s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
2025-11-26 19:33:19 +01:00
Tellsanguis
5c235e86be feat(terraform): Upgrade to Proxmox provider v3.0.2-rc05
Update provider version and adjust resource syntax for compatibility.
2025-11-26 19:31:03 +01:00
Tellsanguis
912e27c30f fix(cd): Add OpenTofu setup step to all deployment jobs
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 9s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 8s
CD - Deploy Infrastructure / Deploy on pve3 (push) Failing after 8s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
Deployment jobs were failing with 'tofu: command not found'. Added Setup OpenTofu step to deploy-pve1, deploy-pve2, and deploy-pve3 jobs.
2025-11-13 20:03:49 +01:00
Tellsanguis
aaedb0db3a fix(cd): Replace reusable workflow with inline CI jobs
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 19s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 2s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 2s
CD - Deploy Infrastructure / Deploy on pve3 (push) Failing after 3s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
Forgejo does not fully support reusable workflows (uses:). Duplicated the Terraform validation job directly in the CD workflow to avoid the blocking state.
2025-11-13 20:00:53 +01:00
Tellsanguis
f2ed93a018 fix(ci): Add workflow_call trigger to enable CD integration
Some checks are pending
CD - Deploy Infrastructure / ci (push) Waiting to run
CD - Deploy Infrastructure / Deploy on pve1 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve2 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve3 (push) Blocked by required conditions
CD - Deploy Infrastructure / Validate K3s Cluster (push) Blocked by required conditions
CD - Deploy Infrastructure / Deployment Notification (push) Blocked by required conditions
The CI workflow needs workflow_call to be callable by the CD workflow. Without this, the CD workflow cannot invoke CI as a reusable workflow.
2025-11-13 19:56:13 +01:00
Tellsanguis
801e130679 fix(ci): Exclude main branch from CI workflow
Some checks are pending
CD - Deploy Infrastructure / ci (push) Waiting to run
CD - Deploy Infrastructure / Deploy on pve1 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve2 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve3 (push) Blocked by required conditions
CD - Deploy Infrastructure / Validate K3s Cluster (push) Blocked by required conditions
CD - Deploy Infrastructure / Deployment Notification (push) Blocked by required conditions
CI workflow now runs only on feature branches and PRs. On main, only CD workflow runs (which internally calls CI). This prevents duplicate CI runs.
2025-11-13 19:52:52 +01:00
Tellsanguis
1fc96d7a46 fix(ci): Use environment variables instead of tfvars file
Some checks are pending
CD - Deploy Infrastructure / ci (push) Waiting to run
CD - Deploy Infrastructure / Deploy on pve1 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve2 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve3 (push) Blocked by required conditions
CD - Deploy Infrastructure / Validate K3s Cluster (push) Blocked by required conditions
CD - Deploy Infrastructure / Deployment Notification (push) Blocked by required conditions
CI - Validation / Terraform Validation (push) Successful in 20s
CI - Validation / Ansible Validation (push) Successful in 1m31s
CI - Validation / Kubernetes Validation (push) Successful in 8s
CI - Validation / Security Scan (push) Successful in 21s
Remove terraform.tfvars.example copy that was overriding secret values. Now using TF_VAR_* environment variables exclusively to properly inject secrets from Forgejo.
2025-11-13 19:47:47 +01:00
Tellsanguis
bf6be4c637 fix(terraform): Update token ID in example from terraform to opentofu
Some checks failed
CD - Deploy Infrastructure / ci (push) Waiting to run
CD - Deploy Infrastructure / Deploy on pve1 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve2 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve3 (push) Blocked by required conditions
CD - Deploy Infrastructure / Validate K3s Cluster (push) Blocked by required conditions
CD - Deploy Infrastructure / Deployment Notification (push) Blocked by required conditions
CI - Validation / Terraform Validation (push) Successful in 1m6s
CI - Validation / Ansible Validation (push) Has been cancelled
CI - Validation / Kubernetes Validation (push) Has been cancelled
CI - Validation / Security Scan (push) Has been cancelled
The example file had root@pam!terraform hardcoded, which was overriding the secret value. Updated to match the actual token name.
2025-11-13 19:45:17 +01:00
Tellsanguis
9103a64669 fix(ci): Rename secrets to avoid FORGEJO_ prefix restriction
Some checks failed
CD - Deploy Infrastructure / ci (push) Waiting to run
CD - Deploy Infrastructure / Deploy on pve1 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve2 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve3 (push) Blocked by required conditions
CD - Deploy Infrastructure / Validate K3s Cluster (push) Blocked by required conditions
CD - Deploy Infrastructure / Deployment Notification (push) Blocked by required conditions
CI - Validation / Terraform Validation (push) Successful in 1m4s
CI - Validation / Ansible Validation (push) Has been cancelled
CI - Validation / Kubernetes Validation (push) Has been cancelled
CI - Validation / Security Scan (push) Has been cancelled
Forgejo does not allow secret names starting with FORGEJO_. Renamed:
- FORGEJO_TOKEN -> GIT_TOKEN
- FORGEJO_REPO_URL -> GIT_REPO_URL
2025-11-13 19:41:46 +01:00
Tellsanguis
d940f3a59c fix(ci): Downgrade upload-artifact to v3 for Forgejo compatibility
Some checks are pending
CD - Deploy Infrastructure / ci (push) Waiting to run
CD - Deploy Infrastructure / Deploy on pve1 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve2 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve3 (push) Blocked by required conditions
CD - Deploy Infrastructure / Validate K3s Cluster (push) Blocked by required conditions
CD - Deploy Infrastructure / Deployment Notification (push) Blocked by required conditions
CI - Validation / Terraform Validation (push) Successful in 1m5s
CI - Validation / Ansible Validation (push) Successful in 1m28s
CI - Validation / Kubernetes Validation (push) Successful in 7s
CI - Validation / Security Scan (push) Successful in 17s
upload-artifact@v4 is not supported on Forgejo/GHES. Downgrade to v3 to ensure artifact uploads work correctly.
2025-11-13 19:30:40 +01:00
Tellsanguis
739854a371 feat(ci): Update deployment workflow for Ubuntu 24.04 and LINSTOR
Some checks failed
CD - Deploy Infrastructure / ci (push) Waiting to run
CD - Deploy Infrastructure / Deploy on pve1 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve2 (push) Blocked by required conditions
CD - Deploy Infrastructure / Deploy on pve3 (push) Blocked by required conditions
CD - Deploy Infrastructure / Validate K3s Cluster (push) Blocked by required conditions
CD - Deploy Infrastructure / Deployment Notification (push) Blocked by required conditions
CI - Validation / Terraform Validation (push) Failing after 1m4s
CI - Validation / Ansible Validation (push) Successful in 1m27s
CI - Validation / Kubernetes Validation (push) Successful in 8s
CI - Validation / Security Scan (push) Successful in 17s
Update all deployment jobs to use Ubuntu 24.04 LTS template and LINSTOR storage backend for improved reliability.
2025-11-13 19:06:25 +01:00
Tellsanguis
867c5e6374 feat(terraform): Update to Ubuntu 24.04 LTS and LINSTOR storage
All checks were successful
CI - Validation / Terraform Validation (push) Successful in 17s
CI - Validation / Ansible Validation (push) Successful in 1m31s
CI - Validation / Kubernetes Validation (push) Successful in 8s
CI - Validation / Security Scan (push) Successful in 17s
Update default configuration to use Ubuntu 24.04 LTS template and configure LINSTOR as the storage backend for improved reliability and performance.
2025-11-13 18:54:26 +01:00
Tellsanguis
cf5ea11740 fix(flux): Update repository URL from infra to Homelab
All checks were successful
CI - Validation / Terraform Validation (push) Successful in 14s
CI - Validation / Ansible Validation (push) Successful in 55s
CI - Validation / Kubernetes Validation (push) Successful in 7s
CI - Validation / Security Scan (push) Successful in 12s
- Change GitRepository URL to match new repository name
- Repository renamed from 'infra' to 'Homelab'
2025-11-11 11:06:16 +01:00
Tellsanguis
78d3a46d31 feat(ci): Add HA support for node failures
Some checks are pending
CI - Validation / Terraform Validation (push) Waiting to run
CI - Validation / Ansible Validation (push) Waiting to run
CI - Validation / Kubernetes Validation (push) Waiting to run
CI - Validation / Security Scan (push) Waiting to run
Modified CI/CD workflows to gracefully handle Proxmox node failures:

CI Workflow (ci.yml):
- Terraform Plan only runs on main branch (faster CI on feature branches)
- Plan failures on unavailable nodes don't block validation
- Added warning message when plan fails

Deploy Workflow (deploy.yml):
- Added continue-on-error to all deploy jobs (pve1, pve2, pve3)
- Modified cluster validation to require 2/3 nodes (quorum)
- Enhanced deployment summary with success counter
- Exit codes: 0 if >=2 nodes, 1 if 1 node, 1 if 0 nodes

This ensures the infrastructure remains operational even when one
Proxmox node is down, maintaining HA principles.
2025-11-07 11:32:42 +01:00
Tellsanguis
495bf44ca5 fix(terraform): Add missing VM configurations to tfvars example
Added VM configuration objects for all three nodes:
- k3s_server_1_config: 6 cores, 12GB RAM, 100G disk
- k3s_server_2_config: 6 cores, 12GB RAM, 100G disk
- etcd_witness_config: 2 cores, 2GB RAM, 20G disk

Removed undeclared 'management_bridge' variable that was causing
warnings in terraform plan.

This allows terraform plan to execute successfully in CI with
the example configuration file.
2025-11-07 11:24:29 +01:00
Tellsanguis
6178f9f0bc fix(terraform): Update disk syntax for Proxmox provider v2.9
Changed from nested `disks` block (v3.0 syntax) to flat `disk` block
(v2.9 syntax):
- disks { scsi { scsi0 { disk {...} } } } → disk { slot = 0, ... }
- Added explicit slot, type, and iothread parameters
- Maintains same functionality with v2.9-compatible syntax
2025-11-07 11:20:07 +01:00
Tellsanguis
a7172070ee fix(terraform): Downgrade Proxmox provider to stable v2.9
The v3.0 provider is not yet available as a stable release in the
OpenTofu/Terraform registry. Downgraded to v2.9 which is the latest
stable version.

Also fixed minor yamllint issues in flux.yml:
- Added space after comment marker
- Removed trailing blank line
2025-11-07 10:51:53 +01:00
Tellsanguis
9f2cb11aeb fix(ansible): Resolve YAML linting violations
Fixed yamllint errors and warnings across all Ansible files:
- Reformatted long lines to stay within 80 character limit
- Standardized boolean values to use true/false instead of yes/no
- Fixed YAML folding syntax for multiline strings
- Removed erroneous triple quotes in k3s-server tasks

This resolves all yamllint issues reported by the CI pipeline.
2025-11-07 10:40:53 +01:00
Tellsanguis
052006adee feat(ci): Implement multi-module Terraform workflow 2025-11-07 10:27:09 +01:00
Tellsanguis
10ef8a6c1b fix(ci): Address tool findings and workflow errors 2025-11-07 10:21:55 +01:00
Tellsanguis
cb6b1d666b fix(ci): Resolve dependency issues in workflow 2025-11-07 10:13:09 +01:00
Tellsanguis
aa6ac62d92 fix: CI workflow errors (OpenTofu, sudo) 2025-11-07 10:08:20 +01:00
Tellsanguis
850045e7ed feat: Initial commit 2025-11-07 09:33:38 +01:00