feat(cicd): Ajouter gestion automatique des ressources DRBD Linstor
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 6s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 6s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 2m27s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Failing after 6s
CD - Deploy Infrastructure / Deploy on pve2 (push) Failing after 6s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 2m27s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
- Créer script Python pour gérer les ressources DRBD avant déploiement
* Vérifie l'existence des ressources Linstor
* Crée les ressources si nécessaire avec réplication
* Augmente la taille si elle est insuffisante
* Noms fixes: pm-a7f3c8e1 (VMID 1000) et pm-b4d2f9a3 (VMID 1001)
- Modifier workflow CI/CD pour intégrer le script Python
* Ajouter étape de configuration SSH avec secret LINSTOR_SSH_PRIVATE_KEY
* Exécuter le script avant tofu apply sur pve1 et pve2
- Corriger configuration Terraform des VMs
* Ajouter vga { type = "std" } pour Standard VGA sur toutes les VMs
* Ajouter cpu { type = "host" } pour meilleure performance
* Ajouter replace_triggered_by pour détecter les changements de config
* Ajouter force_create = true sur pve3 pour gérer VM existante
- Résoudre problèmes identifiés
* "No Bootable Device" - Résolu avec Standard VGA et CPU host
* "vmId already in use" - Résolu avec force_create sur etcd-witness
* Détection des modifications de VM - Résolu avec replace_triggered_by
Documentation SSH créée dans cicd_backup/SETUP_SSH_LINSTOR.md
This commit is contained in:
parent
cc26fb97a6
commit
48042b4d36
8 changed files with 672 additions and 5 deletions
54
scripts/copy-template-to-local.sh
Normal file
54
scripts/copy-template-to-local.sh
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
# Script to copy Ubuntu template from LINSTOR to local storage on each node
|
||||
# This is necessary because LINSTOR doesn't support cloning operations properly
|
||||
|
||||
set -e
|
||||
|
||||
TEMPLATE_VMID=9000
|
||||
TEMPLATE_NAME="ubuntu-2404-cloudinit"
|
||||
SOURCE_STORAGE="linstor_storage"
|
||||
TARGET_STORAGE="local"
|
||||
NODES=("acemagician" "elitedesk" "thinkpad")
|
||||
|
||||
echo "=== Copying template $TEMPLATE_NAME (VMID: $TEMPLATE_VMID) to local storage on each node ==="
|
||||
|
||||
for node in "${NODES[@]}"; do
|
||||
echo ""
|
||||
echo "--- Processing node: $node ---"
|
||||
|
||||
# Check if template already exists locally on this node
|
||||
if ssh root@$node "qm status $TEMPLATE_VMID &>/dev/null"; then
|
||||
echo "✓ Template already exists on $node"
|
||||
|
||||
# Check if it's on local storage
|
||||
if ssh root@$node "qm config $TEMPLATE_VMID | grep -q 'local:'"; then
|
||||
echo "✓ Template is already on local storage"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "→ Cloning template from LINSTOR to local storage on $node..."
|
||||
|
||||
# Clone the template to local storage with a temporary VMID
|
||||
TEMP_VMID=$((TEMPLATE_VMID + 1000))
|
||||
|
||||
ssh root@$node "qm clone $TEMPLATE_VMID $TEMP_VMID \
|
||||
--name ${TEMPLATE_NAME}-local \
|
||||
--full \
|
||||
--storage $TARGET_STORAGE \
|
||||
--target $node" || {
|
||||
echo "✗ Failed to clone template on $node"
|
||||
continue
|
||||
}
|
||||
|
||||
echo "✓ Template copied successfully to $node (VMID: $TEMP_VMID)"
|
||||
echo " Note: You can now use VMID $TEMP_VMID or rename to $TEMPLATE_VMID after removing the LINSTOR version"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "=== Template copy complete ==="
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Verify templates exist on each node: ssh root@<node> 'qm list'"
|
||||
echo "2. Update Terraform to use local templates or new VMIDs"
|
||||
echo "3. Optionally remove LINSTOR template after testing"
|
||||
Loading…
Add table
Add a link
Reference in a new issue