Puppet Class: role::postgres::master

Defined in:
modules/role/manifests/postgres/master.pp

Overview



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
# File 'modules/role/manifests/postgres/master.pp', line 1

class role::postgres::master {
    include role::postgres::common
    include ::postgresql::postgis
    include ::passwords::postgres
    include ::profile::base::firewall
    include ::profile::prometheus::postgres_exporter

    class { 'postgresql::master':
        includes => 'tuning.conf',
        root_dir => $role::postgres::common::root_dir,
    }

    system::role { 'postgres::master':
        ensure      => 'present',
        description => 'Postgres db master',
    }

    $postgres_slave = hiera('role::postgres::master::slave', undef)
    if $postgres_slave {
        $postgres_slave_v4 = ipresolve($postgres_slave, 4)
        if $postgres_slave_v4 {
            postgresql::user { "replication@${::postgres_slave}-v4":
                ensure   => 'present',
                user     => 'replication',
                password => $passwords::postgres::replication_pass,
                cidr     => "${::postgres_slave_v4}/32",
                type     => 'host',
                method   => 'md5',
                attrs    => 'REPLICATION',
                database => 'all',
            }
        }
    }

    # An admin user for labs
    postgresql::user { 'labsadmin@labs':
            ensure   => 'present',
            user     => 'labsadmin',
            password => $passwords::postgres::labsadmin_password,
            cidr     => '10.68.16.0/21',
            type     => 'host',
            method   => 'md5',
            attrs    => 'CREATEROLE CREATEDB',
            database => 'template1',
    }
}