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