2016-10-17 04:05:49 +02:00
|
|
|
class zulip_ops::postgres_master {
|
|
|
|
include zulip_ops::base
|
|
|
|
include zulip_ops::postgres_appdb
|
2013-04-17 21:28:03 +02:00
|
|
|
|
2013-11-08 21:17:14 +01:00
|
|
|
$master_packages = [# Packages needed for disk + RAID configuration
|
2018-08-13 21:29:40 +02:00
|
|
|
'xfsprogs',
|
|
|
|
'mdadm',
|
2013-11-08 21:17:14 +01:00
|
|
|
]
|
2018-08-13 21:29:40 +02:00
|
|
|
package { $master_packages: ensure => 'installed' }
|
2013-04-17 22:15:10 +02:00
|
|
|
|
2013-04-17 22:21:03 +02:00
|
|
|
file { '/etc/sysctl.d/40-postgresql.conf':
|
2013-04-17 21:28:03 +02:00
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
2018-04-23 08:30:21 +02:00
|
|
|
mode => '0644',
|
2018-08-13 21:20:34 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/postgresql/40-postgresql.conf.master',
|
2013-04-17 21:28:03 +02:00
|
|
|
}
|
|
|
|
|
2018-08-13 21:29:40 +02:00
|
|
|
file { '/root/setup_disks.sh':
|
2013-04-17 22:15:10 +02:00
|
|
|
ensure => file,
|
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
2018-04-23 08:30:21 +02:00
|
|
|
mode => '0744',
|
2016-10-17 04:05:49 +02:00
|
|
|
source => 'puppet:///modules/zulip_ops/postgresql/setup_disks.sh',
|
2013-04-17 22:15:10 +02:00
|
|
|
}
|
|
|
|
|
2018-08-13 21:29:40 +02:00
|
|
|
exec { 'setup_disks':
|
|
|
|
command => '/root/setup_disks.sh',
|
|
|
|
require => Package["postgresql-${zulip::base::postgres_version}", 'xfsprogs', 'mdadm'],
|
|
|
|
creates => '/dev/md0'
|
2013-04-17 22:15:10 +02:00
|
|
|
}
|
2016-07-31 07:19:32 +02:00
|
|
|
|
|
|
|
# This one will probably fail most of the time
|
2018-08-13 21:29:40 +02:00
|
|
|
exec {'give_nagios_user_access':
|
2018-08-06 15:30:08 +02:00
|
|
|
# lint:ignore:140chars
|
2019-04-13 01:40:36 +02:00
|
|
|
command => "bash -c \"su postgres -c 'psql -v ON_ERROR_STOP=1 zulip < /usr/share/postgresql/${zulip::base::postgres_version}/zulip_nagios_setup.sql' && touch /usr/share/postgresql/${zulip::base::postgres_version}/zulip_nagios_setup.sql.applied\"",
|
2018-08-06 15:30:08 +02:00
|
|
|
# lint:endignore
|
2018-08-13 21:20:34 +02:00
|
|
|
creates => "/usr/share/postgresql/${zulip::base::postgres_version}/zulip_nagios_setup.sql.applied",
|
|
|
|
require => Package["postgresql-${zulip::base::postgres_version}"],
|
2016-07-31 07:19:32 +02:00
|
|
|
}
|
2013-04-17 21:28:03 +02:00
|
|
|
}
|