diff --git a/vm/create_from_template.sh b/vm/create_from_template.sh index d31d1f7..ff8f27f 100644 --- a/vm/create_from_template.sh +++ b/vm/create_from_template.sh @@ -53,6 +53,11 @@ while read -r username; do 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 + if ! grep -q "^user:$username@ainur.iut-fbleau.fr" /etc/pve/user.cfg; then + pveum user add "$username@ainur.iut-fbleau.fr" + fi + 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@ainur.iut-fbleau.fr" ((NEXT_VM_ID++)) done < "$INPUT_FILE"