hecate: allow forced host config templates during install
This commit is contained in:
parent
27758d37c8
commit
7b1f69ab3c
@ -49,6 +49,7 @@ Installer knobs (optional):
|
|||||||
- `HECATE_ENABLE_BOOTSTRAP=1` enables `hecate-bootstrap.service` on this host.
|
- `HECATE_ENABLE_BOOTSTRAP=1` enables `hecate-bootstrap.service` on this host.
|
||||||
- `HECATE_ENABLE_BOOTSTRAP=0` disables it; default `auto` enables bootstrap by default.
|
- `HECATE_ENABLE_BOOTSTRAP=0` disables it; default `auto` enables bootstrap by default.
|
||||||
- `HECATE_MANAGE_NUT=0` skips writing NUT/udev files.
|
- `HECATE_MANAGE_NUT=0` skips writing NUT/udev files.
|
||||||
|
- `HECATE_FORCE_CONFIG_TEMPLATE=coordinator|peer|example` overwrites `/etc/hecate/hecate.yaml` from a known template during install.
|
||||||
- `HECATE_NUT_UPS_NAME` (default inferred from `/etc/hecate/hecate.yaml` target, fallback `pyrphoros`)
|
- `HECATE_NUT_UPS_NAME` (default inferred from `/etc/hecate/hecate.yaml` target, fallback `pyrphoros`)
|
||||||
- `HECATE_NUT_VENDOR_ID` / `HECATE_NUT_PRODUCT_ID` (defaults `0764` / `0601`)
|
- `HECATE_NUT_VENDOR_ID` / `HECATE_NUT_PRODUCT_ID` (defaults `0764` / `0601`)
|
||||||
- `HECATE_NUT_MONITOR_USER` / `HECATE_NUT_MONITOR_PASSWORD` (defaults `monuser` / `hecateupsmon`)
|
- `HECATE_NUT_MONITOR_USER` / `HECATE_NUT_MONITOR_PASSWORD` (defaults `monuser` / `hecateupsmon`)
|
||||||
|
|||||||
@ -21,6 +21,7 @@ NUT_VENDOR_ID="${HECATE_NUT_VENDOR_ID:-0764}"
|
|||||||
NUT_PRODUCT_ID="${HECATE_NUT_PRODUCT_ID:-0601}"
|
NUT_PRODUCT_ID="${HECATE_NUT_PRODUCT_ID:-0601}"
|
||||||
NUT_MONITOR_USER="${HECATE_NUT_MONITOR_USER:-monuser}"
|
NUT_MONITOR_USER="${HECATE_NUT_MONITOR_USER:-monuser}"
|
||||||
NUT_MONITOR_PASSWORD="${HECATE_NUT_MONITOR_PASSWORD:-hecateupsmon}"
|
NUT_MONITOR_PASSWORD="${HECATE_NUT_MONITOR_PASSWORD:-hecateupsmon}"
|
||||||
|
FORCE_CONFIG_TEMPLATE="${HECATE_FORCE_CONFIG_TEMPLATE:-}"
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -325,7 +326,27 @@ echo "[install] installing config + state dirs"
|
|||||||
install -d -m 0750 "${CONF_DIR}"
|
install -d -m 0750 "${CONF_DIR}"
|
||||||
install -d -m 0750 "${STATE_DIR}"
|
install -d -m 0750 "${STATE_DIR}"
|
||||||
install -d -m 0755 "${LIB_DIR}"
|
install -d -m 0755 "${LIB_DIR}"
|
||||||
if [[ ! -f "${CONF_DIR}/hecate.yaml" ]]; then
|
|
||||||
|
if [[ -n "${FORCE_CONFIG_TEMPLATE}" ]]; then
|
||||||
|
case "${FORCE_CONFIG_TEMPLATE}" in
|
||||||
|
coordinator)
|
||||||
|
install -m 0640 configs/hecate.titan-db.yaml "${CONF_DIR}/hecate.yaml"
|
||||||
|
echo "[install] forced config template: coordinator"
|
||||||
|
;;
|
||||||
|
peer)
|
||||||
|
install -m 0640 configs/hecate.tethys.yaml "${CONF_DIR}/hecate.yaml"
|
||||||
|
echo "[install] forced config template: peer"
|
||||||
|
;;
|
||||||
|
example)
|
||||||
|
install -m 0640 configs/hecate.example.yaml "${CONF_DIR}/hecate.yaml"
|
||||||
|
echo "[install] forced config template: example"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "[install] unknown HECATE_FORCE_CONFIG_TEMPLATE value: ${FORCE_CONFIG_TEMPLATE}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
elif [[ ! -f "${CONF_DIR}/hecate.yaml" ]]; then
|
||||||
install -m 0640 configs/hecate.example.yaml "${CONF_DIR}/hecate.yaml"
|
install -m 0640 configs/hecate.example.yaml "${CONF_DIR}/hecate.yaml"
|
||||||
echo "[install] wrote default config to ${CONF_DIR}/hecate.yaml"
|
echo "[install] wrote default config to ${CONF_DIR}/hecate.yaml"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user