diff --git a/puppet/kandra/files/postgresql/setup_disks.sh b/puppet/kandra/files/postgresql/setup_disks.sh index 6e4d42fd31..a45045159e 100755 --- a/puppet/kandra/files/postgresql/setup_disks.sh +++ b/puppet/kandra/files/postgresql/setup_disks.sh @@ -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 diff --git a/puppet/kandra/manifests/profile/postgresql.pp b/puppet/kandra/manifests/profile/postgresql.pp index d3f73b99a0..8c973212bb 100644 --- a/puppet/kandra/manifests/profile/postgresql.pp +++ b/puppet/kandra/manifests/profile/postgresql.pp @@ -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":