aboutsummaryrefslogtreecommitdiffstats
path: root/modules/postgresql/manifests/server.pp
blob: 29fa30d0599a9ebeb193e0ffc9d909a44dbc51b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class postgresql::server {
    include postgresql::var

    # missing requires is corrected in cooker,
    # should be removed
    # once the fix is in a stable release
    package { "postgresql${postgresql::var::pg_version}-plpgsql":
        alias => 'postgresql-plpgsql',
    }

    package { "postgresql${postgresql::var::pg_version}-server":
        alias   => 'postgresql-server',
        require => Package['postgresql-plpgsql'],
    }

    service { 'postgresql':
        subscribe => Package['postgresql-server'],
    }

    exec { 'service postgresql reload':
        refreshonly => true,
    }

    openssl::self_signed_splitted_cert { "pgsql.$::domain":
        filename  => 'server',
        directory => $postgresql::var::pgsql_data,
        owner     => 'postgres',
        group     => 'postgres',
        require   => Package['postgresql-server']
    }


    file { '/etc/pam.d/postgresql':
        content => template('postgresql/pam'),
    }

    @postgresql::pg_hba { $postgresql::var::hba_file: }

    postgresql::hba_entry { 'allow_local_ipv4':
        type     => 'host',
        database => 'all',
        user     => 'all',
        address  => '127.0.0.1/32',
        method   => 'md5',
    }

    postgresql::config {
        "${postgresql::var::pgsql_data}/pg_ident.conf":
            content => template('postgresql/pg_ident.conf');
        "${postgresql::var::pgsql_data}/postgresql.conf":
            content => template('postgresql/postgresql.conf');
    }
}