2013-04-17 21:28:03 +02:00
|
|
|
class humbug::postgres-common {
|
2013-02-07 22:20:10 +01:00
|
|
|
class { 'humbug::base': }
|
|
|
|
|
2013-04-22 17:24:28 +02:00
|
|
|
$postgres_packages = [ "postgresql-9.1", "pgtune", "python-boto",
|
2013-05-23 21:07:35 +02:00
|
|
|
"python-argparse", "python-gevent",
|
2013-05-10 18:15:51 +02:00
|
|
|
"lzop", "pv", "hunspell-en-us", "python-dateutil"]
|
2013-02-07 22:20:10 +01:00
|
|
|
package { $postgres_packages: ensure => "installed" }
|
|
|
|
|
2013-04-22 17:24:28 +02:00
|
|
|
exec {"pip_wal-e":
|
|
|
|
command => "/usr/bin/pip install git+git://github.com/zbenjamin/wal-e.git#egg=wal-e",
|
|
|
|
creates => "/usr/local/bin/wal-e",
|
|
|
|
require => Package['python-pip', 'python-boto', 'python-argparse',
|
2013-05-23 21:07:35 +02:00
|
|
|
'python-gevent', 'lzop', 'pv'],
|
2013-04-22 17:24:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
file { "/usr/local/bin/env-wal-e":
|
|
|
|
ensure => file,
|
|
|
|
owner => "root",
|
|
|
|
group => "postgres",
|
|
|
|
mode => 750,
|
|
|
|
source => "puppet:///modules/humbug/postgresql/env-wal-e",
|
|
|
|
}
|
|
|
|
|
2013-05-10 18:15:51 +02:00
|
|
|
file { "/usr/local/bin/pg_backup_and_purge.py":
|
|
|
|
ensure => file,
|
|
|
|
owner => "root",
|
|
|
|
group => "postgres",
|
|
|
|
mode => 754,
|
|
|
|
source => "puppet:///modules/humbug/postgresql/pg_backup_and_purge.py",
|
|
|
|
require => File["/usr/local/bin/env-wal-e"],
|
|
|
|
}
|
|
|
|
|
2013-02-07 22:20:10 +01:00
|
|
|
file { "/etc/postgresql/9.1/main/pg_hba.conf":
|
|
|
|
require => Package["postgresql-9.1"],
|
|
|
|
ensure => file,
|
|
|
|
owner => "postgres",
|
|
|
|
group => "postgres",
|
|
|
|
mode => 640,
|
2013-02-08 00:33:31 +01:00
|
|
|
source => "puppet:///modules/humbug/postgresql/pg_hba.conf",
|
2013-02-07 22:20:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
exec { "sysctl_p":
|
2013-04-17 22:21:03 +02:00
|
|
|
command => "/sbin/sysctl -p /etc/sysctl.d/40-postgresql.conf",
|
|
|
|
subscribe => File['/etc/sysctl.d/40-postgresql.conf'],
|
2013-02-08 00:55:51 +01:00
|
|
|
refreshonly => true,
|
2013-02-07 22:20:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
exec { "disable_logrotate":
|
2013-02-07 23:55:40 +01:00
|
|
|
command => "/usr/bin/dpkg-divert --rename --divert /etc/logrotate.d/postgresql-common.disabled --add /etc/logrotate.d/postgresql-common",
|
2013-02-08 00:03:07 +01:00
|
|
|
creates => '/etc/logrotate.d/postgresql-common.disabled',
|
2013-02-07 22:20:10 +01:00
|
|
|
}
|
|
|
|
}
|