mirror of
https://github.com/flynx/proxmox-utils.git
synced 2025-12-25 21:02:04 +00:00
Compare commits
10 Commits
5282959b9b
...
73da4ed12c
| Author | SHA1 | Date | |
|---|---|---|---|
| 73da4ed12c | |||
| 7e091183ce | |||
| 4871f73d52 | |||
| 8af5a74a60 | |||
| 5400fa174f | |||
| eab3056379 | |||
| 15c01c1c0e | |||
| c17133e818 | |||
| 7926aa771f | |||
| 63f8ae15ba |
33
.pct-helpers
33
.pct-helpers
@ -242,7 +242,7 @@ buildAssets(){
|
||||
local TEMPLATE_DIR=$1
|
||||
TEMPLATE_DIR=${TEMPLATE_DIR:=templates}
|
||||
local ASSETS_DIR=$2
|
||||
TEMPLATE_DIR=${ASSETS_DIR:=assets}
|
||||
ASSETS_DIR=${ASSETS_DIR:=assets}
|
||||
|
||||
local TEMPLATES=($(find "$TEMPLATE_DIR" -type f))
|
||||
for file in "${TEMPLATES[@]}" ; do
|
||||
@ -254,15 +254,28 @@ buildAssets(){
|
||||
mkdir -p "$(dirname "${ASSETS_DIR}/${file}")"
|
||||
cat "${TEMPLATE_DIR}/${file}" \
|
||||
| sed \
|
||||
-e 's/\${EMAIL}/'$EMAIL'/' \
|
||||
-e 's/\${DOMAIN}/'$DOMAIN'/' \
|
||||
-e 's/\${CTHOSTNAME}/'$CTHOSTNAME'/' \
|
||||
-e 's/\${WAN_IP}/'${WAN_IP/\//\\/}'/' \
|
||||
-e 's/\${WAN_GATE}/'$WAN_GATE'/' \
|
||||
-e 's/\${LAN_IP}/'${LAN_IP/\//\\/}'/' \
|
||||
-e 's/\${LAN_GATE}/'$LAN_GATE'/' \
|
||||
-e 's/\${ADMIN_IP}/'${ADMIN_IP/\//\\/}'/' \
|
||||
-e 's/\${ADMIN_GATE}/'$ADMIN_GATE'/' \
|
||||
-e 's/\${EMAIL}/'${EMAIL/\//\\/}'/g' \
|
||||
-e 's/\${DOMAIN}/'${DOMAIN/\//\\/}'/g' \
|
||||
-e 's/\${CTHOSTNAME}/'${CTHOSTNAME/\//\\/}'/g' \
|
||||
-e 's/\${GATE_HOSTNAME}/'${GATE_HOSTNAME/\//\\/}'/g' \
|
||||
-e 's/\${NS_HOSTNAME}/'${NS_HOSTNAME/\//\\/}'/g' \
|
||||
-e 's/\${GATE_LAN_IP}/'${GATE_LAN_IP/\//\\/}'/g' \
|
||||
-e 's/\${GATE_LAN_IPn}/'${GATE_LAN_IP/\/*}'/g' \
|
||||
-e 's/\${GATE_ADMIN_IP}/'${GATE_ADMIN_IP/\//\\/}'/g' \
|
||||
-e 's/\${GATE_ADMIN_IPn}/'${GATE_ADMIN_IP/\/*}'/g' \
|
||||
-e 's/\${NS_LAN_IP}/'${NS_LAN_IP/\//\\/}'/g' \
|
||||
-e 's/\${NS_LAN_IPn}/'${NS_LAN_IP/\/*}'/g' \
|
||||
-e 's/\${NS_ADMIN_IP}/'${NS_ADMIN_IP/\//\\/}'/g' \
|
||||
-e 's/\${NS_ADMIN_IPn}/'${NS_ADMIN_IP/\/*}'/g' \
|
||||
-e 's/\${WAN_IP}/'${WAN_IP/\//\\/}'/g' \
|
||||
-e 's/\${WAN_IPn}/'${WAN_IP/\/*}'/g' \
|
||||
-e 's/\${WAN_GATE}/'${WAN_GATE/\//\\/}'/g' \
|
||||
-e 's/\${LAN_IP}/'${LAN_IP/\//\\/}'/g' \
|
||||
-e 's/\${LAN_IPn}/'${LAN_IP/\/*}'/g' \
|
||||
-e 's/\${LAN_GATE}/'${LAN_GATE/\//\\/}'/' \
|
||||
-e 's/\${ADMIN_IP}/'${ADMIN_IP/\//\\/}'/g' \
|
||||
-e 's/\${ADMIN_IPn}/'${ADMIN_IP/\/*}'/g' \
|
||||
-e 's/\${ADMIN_GATE}/'${ADMIN_GATE/\//\\/}'/g' \
|
||||
> "${ASSETS_DIR}/${file}"
|
||||
done
|
||||
}
|
||||
|
||||
11
Makefile
11
Makefile
@ -8,15 +8,18 @@ config.global: config.global.example
|
||||
config: config.global
|
||||
|
||||
|
||||
gate: gate-traefik
|
||||
.PHONY: gate
|
||||
gate: ./gate-traefik
|
||||
$</make.sh
|
||||
|
||||
|
||||
ns: ns
|
||||
$</make.sh
|
||||
.PHONY: ns
|
||||
ns:
|
||||
$@/make.sh
|
||||
|
||||
|
||||
all: config gate ns
|
||||
.PHONY: all
|
||||
all: config gate dns
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2,8 +2,10 @@
|
||||
|
||||
A set of scripts for automating setup and tasks in proxmox.
|
||||
|
||||
## TODO
|
||||
- revise defaults
|
||||
|
||||
# Goals
|
||||
## Goals
|
||||
- support the basic CT lifecicle:
|
||||
- setup/build/update
|
||||
- run
|
||||
|
||||
@ -13,5 +13,15 @@ DFL_WAN_BRIDGE=2
|
||||
DFL_LAN_BRIDGE=0
|
||||
DFL_ADMIN_BRIDGE=1
|
||||
|
||||
# this can be used for passing in ssh keys, etc...
|
||||
DFL_PCT_EXTRA=
|
||||
|
||||
NS_HOSTNAME=ns
|
||||
NS_ADMIN_IP=10.0.0.1/24
|
||||
NS_LAN_IP=10.1.1.1/24
|
||||
|
||||
GATE_HOSTNAME=gate
|
||||
GATE_ADMIN_IP=10.0.0.2/24
|
||||
GATE_LAN_IP=10.1.1.2/24
|
||||
|
||||
|
||||
|
||||
@ -22,14 +22,14 @@ source ../.pct-helpers
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
DFL_ID=${DFL_ID:=101}
|
||||
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=gate}
|
||||
DFL_CTHOSTNAME=${GATE_HOSTNAME:=${DFL_CTHOSTNAME:=gate}}
|
||||
|
||||
DFL_WAN_IP=${DFL_WAN_IP:=192.168.1.101/24}
|
||||
DFL_WAN_GATE=${DFL_WAN_GATE:=192.168.1.252}
|
||||
DFL_WAN_IP=${DFL_WAN_IP}
|
||||
DFL_WAN_GATE=${DFL_WAN_GATE}
|
||||
|
||||
DFL_ADMIN_IP=${DFL_ADMIN_IP:=10.0.0.2/24}
|
||||
DFL_ADMIN_IP=${GATE_ADMIN_IP:=${DFL_ADMIN_IP:=10.0.0.2/24}}
|
||||
ADMIN_GATE=-
|
||||
DFL_LAN_IP=${DFL_LAN_IP:=10.1.1.2/24}
|
||||
DFL_LAN_IP=${GATE_LAN_IP:=${DFL_LAN_IP:=10.1.1.2/24}}
|
||||
LAN_GATE=-
|
||||
|
||||
REBOOT=${REBOOT:=1}
|
||||
|
||||
@ -4,12 +4,12 @@ iface lo inet6 loopback
|
||||
|
||||
auto admin
|
||||
iface admin inet static
|
||||
address 10.0.0.2
|
||||
address ${ADMIN_IP}
|
||||
hostname $(hostname)
|
||||
|
||||
auto lan
|
||||
iface lan inet static
|
||||
address 10.1.1.2
|
||||
address ${LAN_IP}
|
||||
hostname $(hostname)
|
||||
|
||||
auto wan
|
||||
|
||||
10
ns/make.sh
10
ns/make.sh
@ -21,15 +21,16 @@ source ../.pct-helpers
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
DFL_ID=100
|
||||
DFL_CTHOSTNAME=ns
|
||||
DFL_ID=${DFL_ID:=100}
|
||||
DFL_CTHOSTNAME=${NS_HOSTNAME:=${DFL_CTHOSTNAME:=ns}}
|
||||
|
||||
WAN_IP=-
|
||||
WAN_GATE=-
|
||||
DFL_ADMIN_IP=${DFL_ADMIN_IP:=10.0.0.1/24}
|
||||
ADMIN_GATE=-
|
||||
DFL_LAN_IP=${DFL_LAN_IP:=10.1.1.1/24}
|
||||
DFL_LAN_GATE=${DFL_LAN_IP:=10.1.1.2/24}
|
||||
DFL_LAN_IP=${NS_LAN_IP:=${DFL_LAN_IP:=10.1.1.1/24}}
|
||||
DFL_LAN_GATE=${GATE_LAN_IP:=${DFL_LAN_GATE:=10.1.1.2}}
|
||||
DFL_LAN_GATE=${DFL_LAN_GATE/\/*}
|
||||
|
||||
REBOOT=${REBOOT:=1}
|
||||
|
||||
@ -80,5 +81,6 @@ pctSet $ID "${OPTS_STAGE_2}" $REBOOT
|
||||
echo "# Done."
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# vim:set ts=4 sw=4 :
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# XXX get domain ips from config...
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
# DNS
|
||||
|
||||
@ -41,16 +43,16 @@ dhcp-range=interface:admin,10.0.0.20,10.0.0.200,12h
|
||||
dhcp-range=interface:lan,10.1.1.20,10.1.1.200,12h
|
||||
|
||||
# ns
|
||||
address=/ns/10.0.0.1
|
||||
address=/ns/10.1.1.1
|
||||
address=/${CTHOSTNAME}/${ADMIN_IPn}
|
||||
address=/${CTHOSTNAME}/${LAN_IPn}
|
||||
|
||||
# gate
|
||||
address=/gate/10.0.0.2
|
||||
address=/gate/10.1.1.2
|
||||
dhcp-option=admin,option:router,10.0.0.2
|
||||
dhcp-option=lan,option:router,10.1.1.2
|
||||
dhcp-host=admin,gate,10.0.0.2,infinite
|
||||
dhcp-host=lan,gate,10.1.1.2,infinite
|
||||
address=/${GATE_HOSTNAME}/${GATE_ADMIN_IPn}
|
||||
address=/${GATE_HOSTNAME}/${LAN_GATE}
|
||||
dhcp-option=admin,option:router,${GATE_ADMIN_IPn}
|
||||
dhcp-option=lan,option:router,${LAN_GATE}
|
||||
dhcp-host=admin,gate,${GATE_ADMIN_IPn},infinite
|
||||
dhcp-host=lan,gate,${LAN_GATE},infinite
|
||||
|
||||
# pve
|
||||
address=/pve/10.0.0.254
|
||||
@ -2,21 +2,15 @@ auto lo
|
||||
iface lo inet loopback
|
||||
iface lo inet6 loopback
|
||||
|
||||
# bootstrap...
|
||||
auto wan
|
||||
iface wan inet static
|
||||
address ${WAN_IP}
|
||||
gateway ${WAN_GATE}
|
||||
hostname $(hostname)
|
||||
|
||||
auto lan
|
||||
iface lan inet static
|
||||
address 10.0.0.1/24
|
||||
gateway 10.0.0.2
|
||||
address ${LAN_IP}
|
||||
gateway ${LAN_GATE}
|
||||
hostname $(hostname)
|
||||
|
||||
auto admin
|
||||
iface admin inet dhcp
|
||||
iface admin inet static
|
||||
address ${ADMIN_IP}
|
||||
hostname $(hostname)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user