From b5c65548d5632b8261c7f4ea6f4f922a9b4f836d Mon Sep 17 00:00:00 2001 From: Lyanis SOUIDI Date: Mon, 21 Oct 2024 14:58:02 +0200 Subject: [PATCH] dhcp conf --- vm/create_from_template.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vm/create_from_template.sh b/vm/create_from_template.sh index 91697a9..d31d1f7 100644 --- a/vm/create_from_template.sh +++ b/vm/create_from_template.sh @@ -13,6 +13,11 @@ if ! command -v jq &> /dev/null; then exit 1 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 echo "Usage: $0 " echo "Input file format:" @@ -45,6 +50,9 @@ while read -r username; do qm set $NEXT_VM_ID --cores $NEW_CORES --memory $NEW_RAM 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" ((NEXT_VM_ID++)) done < "$INPUT_FILE"