4
0

Add scripts

This commit is contained in:
Lyanis SOUIDI 2024-05-11 20:30:37 +02:00
commit f8e1b44a93
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#!/bin/bash
# Create backup and remove subscription warning from js file
sed -Ezi.bak "s/(function\(orig_cmd\) \{)/\1\n\torig_cmd\(\);\n\treturn;/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy.service

View File

@ -0,0 +1,29 @@
#!/bin/bash
INPUT_FILE=$1
if [ -z "$INPUT_FILE" ]; then
echo "Usage: $0 <path-to-input-file>"
echo "Input file format:"
echo -e "\tusername pool_name"
echo -e "\tusername pool_name"
echo -e "\t..."
exit 1
fi
NEXT_VM_ID=202404101
TEMPLATE_VM_ID=202404001
while read -r line; do
USERNAME=$(echo "$line" | awk '{print $1}')
POOL_NAME=$(echo "$line" | awk '{print $2}')
echo "Creating VM for $USERNAME ($POOL_NAME)"
qm clone $TEMPLATE_VM_ID $NEXT_VM_ID --name "$USERNAME" --full false --pool $POOL_NAME
pvesh set /access/acl --path /vms/$NEXT_VM_ID --roles PVEVMUser --users "$USERNAME@arda.lan"
((NEXT_VM_ID++))
done < "$INPUT_FILE"