Update vmcreate.sh
This commit is contained in:
@@ -5,10 +5,11 @@
|
|||||||
# ИЗУЧИТЬ!!!! /usr/share/pve-docs/examples/guest-example-hookscript.pl
|
# ИЗУЧИТЬ!!!! /usr/share/pve-docs/examples/guest-example-hookscript.pl
|
||||||
|
|
||||||
storage="syno-tigra"
|
storage="syno-tigra"
|
||||||
path="/mnt/pve/$storage/snippets/"
|
path="/mnt/pve/${storage}/snippets/"
|
||||||
node=3
|
node=3
|
||||||
size=50
|
size=50
|
||||||
remove=false
|
remove=false
|
||||||
|
template="user.yaml"
|
||||||
|
|
||||||
harule=""
|
harule=""
|
||||||
pubkey=""
|
pubkey=""
|
||||||
@@ -31,6 +32,7 @@ show_help () {
|
|||||||
echo "-n - specify target node NUMBER to migrate VM to after creating. Default is '3'"
|
echo "-n - specify target node NUMBER to migrate VM to after creating. Default is '3'"
|
||||||
echo "-t - add additional proxmox tag. Default is only pve node number."
|
echo "-t - add additional proxmox tag. Default is only pve node number."
|
||||||
echo "-f - get IP addresses and Hostnames from 'flilename'."
|
echo "-f - get IP addresses and Hostnames from 'flilename'."
|
||||||
|
echo "-s - specify custom snippet template. Default is 'user.yaml'"
|
||||||
echo "-R - REMOVE specified VMs, snippets and HA rule (if specified). Be careful! It's a production cluster!"
|
echo "-R - REMOVE specified VMs, snippets and HA rule (if specified). Be careful! It's a production cluster!"
|
||||||
echo
|
echo
|
||||||
echo "If file not specified, script will use arguments as a list of IP addresses."
|
echo "If file not specified, script will use arguments as a list of IP addresses."
|
||||||
@@ -134,6 +136,7 @@ while getopts "a:f:hk:u:p:d:n:t:R" opt; do
|
|||||||
d) size=${OPTARG};;
|
d) size=${OPTARG};;
|
||||||
n) node=${OPTARG};;
|
n) node=${OPTARG};;
|
||||||
t) tag=${OPTARG};;
|
t) tag=${OPTARG};;
|
||||||
|
s) template=${OPTARG};;
|
||||||
R) remove=true;;
|
R) remove=true;;
|
||||||
\?) echo "Invalid option."; show_help; exit 1;;
|
\?) echo "Invalid option."; show_help; exit 1;;
|
||||||
esac
|
esac
|
||||||
@@ -141,6 +144,8 @@ done
|
|||||||
|
|
||||||
if [ $tag ]; then tag=",${tag}"; fi
|
if [ $tag ]; then tag=",${tag}"; fi
|
||||||
|
|
||||||
|
if [ ! -f $template ]; then echo "Specified snippet template does not exist. Aborting."; exit 10; fi
|
||||||
|
|
||||||
if [ $harule ]; then
|
if [ $harule ]; then
|
||||||
hostcheck "$harule"
|
hostcheck "$harule"
|
||||||
if [ $? -ne 0 ]; then echo "HArule should contain only letters, numbers and dashes. Aborting."; exit 1; fi
|
if [ $? -ne 0 ]; then echo "HArule should contain only letters, numbers and dashes. Aborting."; exit 1; fi
|
||||||
|
|||||||
Reference in New Issue
Block a user