Files
pxe_boot_alma/work/KickStart/cfg/probe-config/L200-custDB.sh
T
andersenandClaude Fable 5 6d398b826a refactor: move tree under homelab/, add alma10 hardening and kickstart docs
- restructure boot/kickstarts/scripts/docs into homelab/
- docs: alma9->10 breaking changes, CIS hardening, kickstart changes
- add find_cron_entries.sh helper and codex running memory notes

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-06 22:35:07 -04:00

53 lines
1.5 KiB
Bash

#
# Setup customer DBs on probe
#
if [ -z "$PROBE" ]; then
Warn "Probe name required for cust DB setup."
elif [ -z "$CUST" ]; then
Warn "Customer required for cust DB setup"
else
PGHOME=$(ls -vd /usr/pgsql* | tail -1)
if [ -d "$PGHOME" ]; then
PGDATA=/opt/iglass/pgdata/data${PGHOME/#\/usr\/pgsql}/
echo "Using PGDATA=$PGDATA"
echo "hostssl all all 10.1.1.1/32 scram-sha-256" >> ${PGDATA}iglass/pg_hba.conf
systemctl reload "postgresql${PGHOME/#\/usr\/pgsql}.service"
else
echo "Could not find pg versions for PGDATA. Hope this works."
fi
ADDR=
for IP in $(hostname -I); do
if echo $IP | grep -qE '^10\.1\.1\.'; then
ADDR="$IP"
fi
done
if [ -z "$ADDR" ]; then
Warn "No local ip address found. Could not setup probe DB"
else
echo "Setting up $CUST DB for $PROBE at $ADDR:"
$SSH "sudo -u noc /opt/iglass/bin/dbMgr.pl --db=$CUST --dbtype=cust-probe --host=$ADDR --create"
$SSH "sudo -u noc /opt/iglass/bin/dbMgr.pl --db=$CUST --dbtype=cust-probe --host=$ADDR"
$SSH "sudo -u noc /opt/iglass/bin/dbMgr.pl --db=$CUST --dbtype=cust-probe --host=$ADDR --schema=$PROBE-probe --create"
$SSH "sudo -u noc /opt/iglass/bin/dbMgr.pl --db=$CUST --dbtype=cust-probe --host=$ADDR --schema=$PROBE-probe"
fi
if [ -d "$PGHOME" ]; then
perl -ni -e 'print unless /\s10\.1\.1\.1\/32\s/' ${PGDATA}iglass/pg_hba.conf
systemctl reload "postgresql${PGHOME/#\/usr\/pgsql}.service"
fi
fi
Continue