]>
Commit | Line | Data |
---|---|---|
3925777d IB |
1 | class profile::postgresql ( |
2 | Optional[String] $pg_user = "postgres", | |
3 | Optional[String] $pg_group = "postgres", | |
4 | ) { | |
a045b9dc | 5 | $password_seed = lookup("base_installation::puppet_pass_seed") |
57ae81ea IB |
6 | |
7 | class { '::postgresql::globals': | |
8 | encoding => 'UTF-8', | |
9 | locale => 'en_US.UTF-8', | |
10 | pg_hba_conf_defaults => false, | |
11 | } | |
12 | ||
57ae81ea IB |
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, | |
3925777d | 19 | group => $pg_group, |
57ae81ea IB |
20 | before => File["/var/lib/postgres/data"], |
21 | require => Package["postgresql-server"], | |
22 | } | |
23 | ||
24 | class { '::postgresql::server': | |
b3015828 IB |
25 | postgres_password => generate_password(24, $password_seed, "postgres"), |
26 | listen_addresses => "*", | |
57ae81ea IB |
27 | } |
28 | ||
3925777d | 29 | profile::postgresql::base_pg_hba_rules { "default": } |
57ae81ea | 30 | |
b5305b5c IB |
31 | @profile::monitoring::local_service { "Databases are present in postgresql": |
32 | sudos => { | |
a0df248a | 33 | "naemon-postgresql-database-public" => "naemon ALL=(postgres) NOPASSWD: /usr/bin/psql -c select\\ nspname\\ from\\ pg_catalog.pg_namespace" |
b5305b5c IB |
34 | }, |
35 | local => { | |
36 | check_command => "check_command_output!psql -c 'select nspname from pg_catalog.pg_namespace'!public!-r postgres", | |
37 | } | |
38 | } | |
57ae81ea IB |
39 | } |
40 |