Update vmcreate1.sh
This commit is contained in:
@@ -100,7 +100,7 @@ mksnippet(){
|
||||
}
|
||||
|
||||
# Обрабатываем опции
|
||||
while getopts "a:f:hk:u:p:d:t" opt; do
|
||||
while getopts "a:f:hk:u:p:d:t:" opt; do
|
||||
case $opt in
|
||||
a) harule="$OPTARG";;
|
||||
f) file="$OPTARG" ;;
|
||||
@@ -109,7 +109,7 @@ while getopts "a:f:hk:u:p:d:t" opt; do
|
||||
u) username="$OPTARG";;
|
||||
p) password="$OPTARG";;
|
||||
d) size="$OPTARG";;
|
||||
t) tag="$OPTARG";;
|
||||
t) tag=,"$OPTARG";;
|
||||
*) echo "Invalid option. Use '-h' for help."; exit 1;;
|
||||
esac
|
||||
done
|
||||
@@ -223,7 +223,7 @@ do
|
||||
ip=$(echo -n "$line" | cut -d ',' -f 1)
|
||||
vmid=$(get_vmid "$ip")
|
||||
snippet=
|
||||
if [[ (qm status "$vmid") ]]; then
|
||||
if qm status "$vmid"; then
|
||||
echo "VM $vmid exists. Aborting"
|
||||
exit 9
|
||||
elif [[ -e "$snippet" ]]; then
|
||||
@@ -272,7 +272,7 @@ do
|
||||
echo "ERROR"
|
||||
exit 8
|
||||
fi
|
||||
qm set $vmid --tags "${node},${tag}"
|
||||
qm set $vmid --tags "${node}${tag}"
|
||||
qm resize $vmid scsi0 +"$size"G
|
||||
qm set $vmid --cicustom "user=${storage}:snippets/${vmnum}_user.yaml"
|
||||
qm set $vmid --ipconfig0 ip="$ip"/"$mask",gw="$gw"
|
||||
|
||||
Reference in New Issue
Block a user