aboutsummaryrefslogtreecommitdiffstats
path: root/modules/postgresql/manifests/init.pp
blob: 7c22c986cc640fd233d79bb5b51c83966ffd7c4d (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
54
55
56
57
58
59
60
class postgresql {
    
    $pgsql_data = "/var/lib/pgsql/data/"

    package { 'postgresql9.0-server':
        alias => "postgresql-server",
        ensure => installed
    }

    service { postgresql:
        ensure => running,
        subscribe => Package["postgresql-server"],
        hasstatus => true,
    }

    exec { "service postgresql reload":
        refreshonly => true,
        subscribe => [ File["postgresql.conf"], 
                       File["pg_ident.conf"],
                       File["pg_hba.conf"] ]
    }

    file { '/etc/pam.d/postgresql':
        ensure => present,
        owner  => root,
        group  => root,
        mode   => 644,
        content => template("postgresql/pam"),
    }

    file { "postgresql.conf":
        path => "$pgsql_data/$name",
        ensure => present,
        owner => postgres,
        group => postgres,
        mode => 600,
        content => template("postgresql/postgresql.conf"),
        require => Package["postgresql-server"],
    }
    
    file { 'pg_hba.conf':
        path => "$pgsql_data/$name",
        ensure => present,
        owner => postgres,
        group => postgres,
        mode => 600,
        content => template("postgresql/pg_hba.conf"),
        require => Package["postgresql-server"],
    }

    file { 'pg_ident.conf':
        path => "$pgsql_data/$name",
        ensure => present,
        owner => postgres,
        group => postgres,
        mode => 600,
        content => template("postgresql/pg_ident.conf"),
        require => Package["postgresql-server"],
    }
}