kandra: Move PostgreSQL data mountpoint to /srv/data.

We store a lot of other things in `/srv` now, and moving them mid-puppet
confuses things significantly.
This commit is contained in:
Alex Vandiver 2024-03-29 03:44:18 +00:00 committed by Tim Abbott
parent 93c6fd4746
commit e4883cc2dc
2 changed files with 12 additions and 13 deletions

View File

@ -17,17 +17,16 @@ if [ -z "$LOCALDISK" ]; then
fi
if ! grep -q "$LOCALDISK" /etc/fstab; then
echo "$LOCALDISK /srv xfs nofail,noatime 1 1" >>/etc/fstab
echo "$LOCALDISK /srv/data xfs nofail,noatime 1 1" >>/etc/fstab
fi
if ! mountpoint -q /srv; then
if [ ! -d /srv/data ]; then
mkdir /srv/data
fi
if ! mountpoint -q /srv/data; then
mkfs.xfs "$LOCALDISK"
# Move any existing files/directories out of the way
TMPDIR=$(mktemp -d)
mv /srv/* "$TMPDIR"
mount /srv
mv "$TMPDIR/"* /srv
rmdir "$TMPDIR"
mount /srv/data
fi
if [ ! -L /var/lib/postgresql ]; then
@ -35,11 +34,11 @@ if [ ! -L /var/lib/postgresql ]; then
if [ -e /var/lib/postgresql ]; then
mv /var/lib/postgresql "/root/postgresql-data-$(date +'%m-%d-%Y-%T')"
fi
ln -s /srv/postgresql/ /var/lib
ln -s /srv/data/postgresql/ /var/lib
fi
if [ ! -e "/srv/postgresql" ]; then
if [ ! -e "/srv/data/postgresql" ]; then
service postgresql stop
mkdir "/srv/postgresql"
chown postgres:postgres /srv/postgresql
mkdir "/srv/data/postgresql"
chown postgres:postgres /srv/data/postgresql
fi

View File

@ -27,7 +27,7 @@ class kandra::profile::postgresql inherits kandra::profile::base {
exec { 'setup_disks':
command => '/root/setup_disks.sh',
require => Package["postgresql-${zulip::postgresql_common::version}", 'xfsprogs', 'nvme-cli'],
unless => 'test /var/lib/postgresql/ -ef /srv/postgresql/',
unless => 'test /var/lib/postgresql/ -ef /srv/data/postgresql/',
}
file { "${zulip::postgresql_base::postgresql_confdir}/pg_hba.conf":