diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp index 122dc8572c..20176d8237 100644 --- a/puppet/zulip/manifests/app_frontend_base.pp +++ b/puppet/zulip/manifests/app_frontend_base.pp @@ -10,10 +10,8 @@ class zulip::app_frontend_base { if $::os['family'] == 'Debian' { # Upgrade and other tooling wants to be able to get a database # shell. This is not necessary on CentOS because the PostgreSQL - # package already includes the client. This may get us a more - # recent client than the database server is configured to be, - # ($zulip::postgresql_common::version), but they're compatible. - zulip::safepackage { 'postgresql-client': ensure => installed } + # package already includes the client. + include zulip::postgresql_client } # For Slack import zulip::safepackage { 'unzip': ensure => installed } diff --git a/puppet/zulip/manifests/postgresql_client.pp b/puppet/zulip/manifests/postgresql_client.pp new file mode 100644 index 0000000000..cffcde3c84 --- /dev/null +++ b/puppet/zulip/manifests/postgresql_client.pp @@ -0,0 +1,8 @@ +class zulip::postgresql_client { + # This may get us a more recent client than the database server is + # configured to be, ($zulip::postgresql_common::version), but + # they're compatible. + package { 'postgresql-client': + ensure => installed, + } +} diff --git a/puppet/zulip_ops/manifests/prometheus/postgresql.pp b/puppet/zulip_ops/manifests/prometheus/postgresql.pp index e41b4a7e10..09e0ca4c0c 100644 --- a/puppet/zulip_ops/manifests/prometheus/postgresql.pp +++ b/puppet/zulip_ops/manifests/prometheus/postgresql.pp @@ -47,9 +47,11 @@ class zulip_ops::prometheus::postgresql { require => Exec['compile postgres_exporter'], } + include zulip::postgresql_client exec { 'create prometheus postgres user': + require => Package['postgresql-client'], command => '/usr/bin/createuser -g pg_monitor prometheus', - unless => '/usr/bin/psql -tAc "select usename from pg_user" | /bin/grep -xq prometheus', + unless => 'test -f /usr/bin/psql && /usr/bin/psql -tAc "select usename from pg_user" | /bin/grep -xq prometheus', user => 'postgres', }