pg: put postgres ssh keys onto backup server
[mirror/dsa-puppet.git] / modules / salsa / manifests / database.pp
1 #
2 class salsa::database inherits salsa {
3         class { 'postgresql::globals':
4                 version => '9.6',
5         }
6         class { 'postgresql::server':
7                 listen_addresses => '*',
8         }
9         class { 'postgresql::server::contrib': }
10
11         postgresql::server::db { $salsa::db_name:
12                 user     => $salsa::db_role,
13                 password => postgresql_password($salsa::db_role, $salsa::db_password),
14         }
15
16         postgresql::server::extension { 'pg_trgm':
17                 database => $salsa::db_name,
18                 require => Class['postgresql::server::contrib'],
19         }
20
21         include postgres::backup_source
22         $datadir = assert_type(String[1], $postgresql::params::datadir)
23         warning("foo ")
24         file { "${datadir}/.nobackup":
25                 content  => ""
26         }
27         if $::postgresql_key {
28                 $ipaddr = assert_type(String[1], join(getfromhash($site::nodeinfo, 'ldap', 'ipHostNumber'), ","))
29
30                 @@concat::fragment { "onion::balance::instance::dsa-snippet::$name::$fqdn":
31                         target  => "/etc/dsa/postgresql-backup/sshkeys-sources",
32                         content  => @("EOF"),
33                                         ${::hostname} ${ipaddr} ${::postgresql_key}
34                                         | EOF
35                         tag     => "postgresql::server::backup-source-sshkey",
36                 }
37         }
38 }