From 04372e3300b51d3abd11fae74bf2cde86341dbed Mon Sep 17 00:00:00 2001 From: rht Date: Thu, 20 Dec 2018 03:40:47 +0000 Subject: [PATCH] puppet: Add CentOS packages to postgres_common.pp. --- puppet/zulip/manifests/postgres_common.pp | 51 ++++++++++++++--------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/puppet/zulip/manifests/postgres_common.pp b/puppet/zulip/manifests/postgres_common.pp index d403b9f2ed..396fbb83cb 100644 --- a/puppet/zulip/manifests/postgres_common.pp +++ b/puppet/zulip/manifests/postgres_common.pp @@ -1,9 +1,11 @@ class zulip::postgres_common { case $::osfamily { 'debian': { + $nagios_plugins = 'nagios-plugins-basic' + $postgresql = "postgresql-${zulip::base::postgres_version}" $postgres_packages = [ # The database itself - "postgresql-${zulip::base::postgres_version}", + $postgresql, # tools for database monitoring 'ptop', # Needed just to support adding postgres user to 'zulip' group @@ -20,38 +22,47 @@ class zulip::postgres_common { ] } 'redhat': { + $nagios_plugins = 'nagios-plugins' + $postgresql = "postgresql${zulip::base::postgres_version}" $postgres_packages = [ - # The database itself - "postgresql-${zulip::base::postgres_version}", - # tools for database monitoring - 'ptop', - # Needed just to support adding postgres user to 'zulip' group - 'ssl-cert', - # our dictionary - 'hunspell-en-us', - # Postgres Nagios check plugin - 'check-postgres', + $postgresql, + "${postgresql}-server", + "${postgresql}-devel", + 'pg_top', + 'ssl-cert', #?? TODO no equivalent on CentOS 7 + 'hunspell-en-US', + # exists on CentOS 6 and Fedora 29 but not CentOS 7 + # see https://pkgs.org/download/check_postgres + # alternatively, download directly from: + # https://bucardo.org/check_postgres/ + # 'check-postgres', # TODO ] exec {'pip2_deps': # Python modules used in our monitoring/worker threads command => '/usr/bin/pip2 install pytz python-dateutil' } - exec {'pip3_deps': command => 'python3 -m pip install pytz python-dateutil' } } + default: { + fail('osfamily not supported') + } } + zulip::safepackage { $postgres_packages: ensure => 'installed' } - exec { 'disable_logrotate': - # lint:ignore:140chars - command => '/usr/bin/dpkg-divert --rename --divert /etc/logrotate.d/postgresql-common.disabled --add /etc/logrotate.d/postgresql-common', - # lint:endignore - creates => '/etc/logrotate.d/postgresql-common.disabled', + if $::osfamily == 'debian' { + # The logrotate file only created in debian-based systems + exec { 'disable_logrotate': + # lint:ignore:140chars + command => '/usr/bin/dpkg-divert --rename --divert /etc/logrotate.d/postgresql-common.disabled --add /etc/logrotate.d/postgresql-common', + # lint:endignore + creates => '/etc/logrotate.d/postgresql-common.disabled', + } } file { '/usr/lib/nagios/plugins/zulip_postgres_common': - require => Package[nagios-plugins-basic], + require => Package[$nagios_plugins], recurse => true, purge => true, owner => 'root', @@ -66,7 +77,7 @@ class zulip::postgres_common { group => 'postgres', mode => '0750', source => 'puppet:///modules/zulip/postgresql/env-wal-e', - require => Package["postgresql-${zulip::base::postgres_version}"], + require => Package[$postgresql], } file { '/usr/local/bin/pg_backup_and_purge': @@ -83,7 +94,7 @@ class zulip::postgres_common { groups => ['ssl-cert'], membership => minimum, require => [ - Package["postgresql-${zulip::base::postgres_version}"], + Package[$postgresql], Package['ssl-cert'] ], }