mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-10-28 10:40:07 +00:00
experimenting with moving current management scripts to make...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
eae24e3aff
commit
0f9ef0a1ae
1
Makefile
1
Makefile
@ -101,4 +101,5 @@ all: minimal $(APP_CTs)
|
||||
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
@ -86,14 +86,21 @@ DFL_PCT_EXTRA=SKIP
|
||||
|
||||
# Nameserver
|
||||
NS_HOSTNAME=ns
|
||||
NS_ID=100
|
||||
NS_ADMIN_IP=10.0.0.1/24
|
||||
NS_LAN_IP=10.1.1.1/24
|
||||
|
||||
RESERVE_NS_ID=101
|
||||
TEMPLATE_NS_ID=200
|
||||
|
||||
# Gateway / Reverse proxy
|
||||
GATE_HOSTNAME=gate
|
||||
GATE_ID=110
|
||||
GATE_ADMIN_IP=10.0.0.2/24
|
||||
GATE_LAN_IP=10.1.1.2/24
|
||||
|
||||
RESERVE_GATE_ID=111
|
||||
TEMPLATE_GATE_ID=210
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
@ -17,9 +17,8 @@ readConfig
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
DFL_ID=${DFL_ID:=101}
|
||||
# XXX revise...
|
||||
DFL_CTHOSTNAME=${GATE_HOSTNAME:=${DFL_CTHOSTNAME:=gate}}
|
||||
DFL_ID=${GATE_ID:=${DFL_ID:-102}}
|
||||
DFL_CTHOSTNAME=${GATE_HOSTNAME:-${DFL_CTHOSTNAME:-gate}}
|
||||
|
||||
CORES=1
|
||||
RAM=128
|
||||
|
||||
@ -17,8 +17,8 @@ readConfig
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
DFL_ID=${DFL_ID:=100}
|
||||
DFL_CTHOSTNAME=${NS_HOSTNAME:=${DFL_CTHOSTNAME:=ns}}
|
||||
DFL_ID=${NS_ID:=${DFL_ID:-100}}
|
||||
DFL_CTHOSTNAME=${NS_HOSTNAME:-${DFL_CTHOSTNAME:-ns}}
|
||||
|
||||
CORES=1
|
||||
RAM=128
|
||||
|
||||
85
reserve/make.sh
Normal file
85
reserve/make.sh
Normal file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/bash
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
cd $(dirname $0)
|
||||
PATH=$PATH:$(dirname "$(pwd)")
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
source ../.pct-helpers
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
CT_PATH=/etc/pve/lxc/
|
||||
|
||||
readConfig
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
makeReserveCT(){
|
||||
local ID=$1
|
||||
local RESERVE_ID=$2
|
||||
local TEMPLATE_ID=$3
|
||||
local HOSTNAME=$(ct2hostname $ID)
|
||||
|
||||
@ pct shutdown $ID
|
||||
|
||||
@ pct destroy $RESERVE_ID --purge
|
||||
@ pct clone $ID $RESERVE_ID --hostname ${HOSTNAME}
|
||||
|
||||
@ pct start $ID
|
||||
|
||||
if [ $TEMPLATE_ID ] ; then
|
||||
@ pct destroy $TEMPLATE_ID --purge
|
||||
@ pct clone $RESERVE_ID $TEMPLATE_ID --hostname ${HOSTNAME}
|
||||
@ pct templates $TEMPLATE_ID
|
||||
fi
|
||||
|
||||
# XXX sould this get into the template...
|
||||
@ pct set $RESERVE_ID -onboot 0
|
||||
}
|
||||
|
||||
startReserveCT(){
|
||||
local ID=$1
|
||||
local RESERVE_ID=$2
|
||||
local TEMPLATE_ID=$3
|
||||
local HOSTNAME=$(ct2hostname $ID)
|
||||
|
||||
@ pct shutdown $ID
|
||||
@ pct set $ID -onboot 0
|
||||
|
||||
# XXX check if a reserve is already up then recreate it from template...
|
||||
|
||||
@ pct start $RESERVE_ID
|
||||
@ pct set $RESERVE_ID -onboot 1
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
xread "Gate ID:" GATE_ID
|
||||
xread "Gate reserve ID:" RESERVE_GATE_ID
|
||||
xread "Gate template ID:" TEMPLATE_GATE_ID
|
||||
|
||||
xread "NS ID:" NS_ID
|
||||
xread "NS reserve ID:" RESERVE_NS_ID
|
||||
xread "NS template ID:" TEMPLATE_NS_ID
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
makeReserveCT $GATE_ID $RESERVE_GATE_ID $TEMPLATE_GATE_ID
|
||||
|
||||
makeReserveCT $NS_ID $RESERVE_NS_ID $TEMPLATE_NS_ID
|
||||
|
||||
saveLastRunConfig
|
||||
|
||||
echo "# Done."
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# vim:set ts=4 sw=4 :
|
||||
Loading…
x
Reference in New Issue
Block a user