mirror of
https://git.valherun.com/valherun/pxe_boot_alma.git
synced 2026-10-15 22:22:03 -04:00
- 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]>
53 lines
1.5 KiB
Bash
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
|