Update qmcreate.sh
This commit is contained in:
17
qmcreate.sh
17
qmcreate.sh
@@ -11,7 +11,7 @@ do
|
||||
qm clone 5000 $vmnum --name $hostname --full
|
||||
if [ $? -eq 0 ]
|
||||
then echo "clone OK"
|
||||
else "clone ERROR"
|
||||
else "clone ERROR"; exit 1
|
||||
fi
|
||||
qm set $vmnum --tags 3,gfx
|
||||
## preparing custom CloudInit snippets
|
||||
@@ -19,13 +19,18 @@ do
|
||||
cp ./network.yaml /mnt/pve/syno-tigra/snippets/${vmnum}_network.yaml
|
||||
sed -i "s/HOSTNAME/$hostname/g" /mnt/pve/syno-tigra/snippets/${vmnum}_user.yaml
|
||||
sed -i "s/IP/$ip/g" /mnt/pve/syno-tigra/snippets/${vmnum}_network.yaml
|
||||
mac=$(cat /etc/pve/qemu-server/${vmnum}.conf | grep net0 | cut -d ',' -f 1 | cut -d '=' -f 2)
|
||||
sed -i sed -i "s/IP/$mac/g" /mnt/pve/syno-tigra/snippets/${vmnum}_network.yaml
|
||||
if [ -f "./gfx.pub "]
|
||||
then echo "key OK"
|
||||
else echo "key ERROR. Put the public key named 'gfx.pub'"
|
||||
else echo "key ERROR. Put the public key named 'gfx.pub'"; exit 2
|
||||
fi
|
||||
#key=$(cat ./gfx.pub)
|
||||
#sed -i 's/KEY/$key/g' /mnt/pve/syno-tigra/snippets/${vmnum}_user.yaml
|
||||
qm set $vmnum --cicustom "user=syno-tigra:snippets/${vmnum}_user.yaml,network=syno-tigra:snippets/${vmnum}_network.yaml" --sshkey ./gfx.pub
|
||||
qm resize $vmnum scsi0 +50G
|
||||
mac=$(cat /etc/pve/qemu-server/${vmnum}.conf | grep net0 | cut -d ',' -f 1 | cut -d '=' -f 2)
|
||||
qm set $vmnum --cicustom "user=syno-tigra:snippets/${vmnum}_user.yaml,network=syno-tigra:snippets/${vmnum}_network.yaml" --sshkey ./gfx.pub
|
||||
qm cloudinit update $vmnum
|
||||
qm start $vmnum
|
||||
if [ $? -eq 0 ]
|
||||
then echo "VM successfully CREATED"
|
||||
else "ERROR creating VM"; exit 3
|
||||
fi
|
||||
done < ./hosts
|
||||
Reference in New Issue
Block a user