4
0

dhcp conf

This commit is contained in:
Lyanis SOUIDI 2024-10-21 14:58:02 +02:00
parent 6e4a718f86
commit b5c65548d5

View File

@ -13,6 +13,11 @@ if ! command -v jq &> /dev/null; then
exit 1 exit 1
fi fi
if ! command -v mariadb &> /dev/null; then
echo "mariadb is not installed. Please install it using 'apt install mariadb-client' to continue."
exit 1
fi
if [ -z "$INPUT_FILE" ] | [ -z "$POOL_NAME" ] | [ -z "$NEXT_VM_ID" ]; then if [ -z "$INPUT_FILE" ] | [ -z "$POOL_NAME" ] | [ -z "$NEXT_VM_ID" ]; then
echo "Usage: $0 <path-to-input-file> <resource-pool-name> <start-vmid>" echo "Usage: $0 <path-to-input-file> <resource-pool-name> <start-vmid>"
echo "Input file format:" echo "Input file format:"
@ -45,6 +50,9 @@ while read -r username; do
qm set $NEXT_VM_ID --cores $NEW_CORES --memory $NEW_RAM qm set $NEXT_VM_ID --cores $NEW_CORES --memory $NEW_RAM
fi fi
MAC_ADDRESS=$(grep -Po 'net\d+: virtio=\K[^,]+' /etc/pve/qemu-server/$NEXT_VM_ID.conf)
mariadb --host=gimli.iut-fbleau.fr --user=proxmox --password="..." -e "CALL add_vm('$MAC_ADDRESS', 'vm-$username')" kea
pvesh set /access/acl --path /vms/$NEXT_VM_ID --roles etu --users "$username@arda.lan" pvesh set /access/acl --path /vms/$NEXT_VM_ID --roles etu --users "$username@arda.lan"
((NEXT_VM_ID++)) ((NEXT_VM_ID++))
done < "$INPUT_FILE" done < "$INPUT_FILE"