]> WPIA git - infra.git/blob - environments/production/manifests/postgres-primary.pp
e90109fd9610458fde006a763dc9e947255b49c1
[infra.git] / environments / production / manifests / postgres-primary.pp
1 node postgres-primary {
2   include container::contained
3   include container::no_ssh
4
5   package{ 'postgresql':
6     ensure => 'installed',
7     install_options => ['--no-install-recommends'],
8   }
9
10   class { 'postgresql::globals':
11     version => '9.6',
12   }->
13   class { 'postgresql::server':
14       listen_addresses => '*',
15   } ->
16   postgresql::server::db { 'gigi':
17     require  => Package['postgresql'],
18     user     => 'gigi',
19     password => postgresql_password('gigi', $passwords[postgres][gigi]),
20   }
21   $gigi_ip = $ips[gigi];
22   postgresql::server::pg_hba_rule { 'allow gigi to access its database':
23     require  => Package['postgresql'],
24     description => "Open up PostgreSQL for access from gigi to its database",
25     type        => 'host',
26     database    => 'gigi',
27     user        => 'gigi',
28     address     => "$gigi_ip/32",
29     auth_method => 'md5',
30   }
31 }