]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - modules/profile/manifests/postgresql.pp
Add monitoring for etherpad
[perso/Immae/Projets/Puppet.git] / modules / profile / manifests / postgresql.pp
1 class profile::postgresql (
2 Optional[String] $pg_user = "postgres",
3 Optional[String] $pg_group = "postgres",
4 ) {
5 $password_seed = lookup("base_installation::puppet_pass_seed")
6
7 class { '::postgresql::globals':
8 encoding => 'UTF-8',
9 locale => 'en_US.UTF-8',
10 pg_hba_conf_defaults => false,
11 }
12
13 class { '::postgresql::client': }
14
15 # FIXME: postgresql module is buggy and doesn't create dir?
16 file { "/var/lib/postgres":
17 ensure => directory,
18 owner => $pg_user,
19 group => $pg_group,
20 before => File["/var/lib/postgres/data"],
21 require => Package["postgresql-server"],
22 }
23
24 class { '::postgresql::server':
25 postgres_password => generate_password(24, $password_seed, "postgres"),
26 listen_addresses => "*",
27 }
28
29 profile::postgresql::base_pg_hba_rules { "default": }
30
31 @profile::monitoring::local_service { "Databases are present in postgresql":
32 sudos => {
33 "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\\ nspname\\ from\\ pg_catalog.pg_namespace"
34 },
35 local => {
36 check_command => "check_command_output!psql -c 'select nspname from pg_catalog.pg_namespace'!public!-r postgres",
37 }
38 }
39 }
40