aboutsummaryrefslogtreecommitdiffstats
path: root/modules/postgresql/manifests/database.pp
blob: 34cee2a60793880794e6bafe0646f8f501ac2126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# TODO convert it to a regular type ( so we can later change user and so on )
define postgresql::database($description = '',
                            $user = 'postgres',
                            $callback_notify = '') {

    exec { "createdb -O ${user} -U postgres ${name} '${description}' ":
        user    => 'root',
        unless  => "psql -A -t -U postgres -l | grep '^${name}|'",
        require => Service['postgresql'],
    }

    # this is fetched by the manifest asking the database creation,
    # once the db have been created
    # FIXME proper ordering ?
    # FIXME In puppet >3.0 word 'tag' is reserved, so it has to be renamed
    @@postgresql::database_callback { $name:
        tag             => $name,
        callback_notify => $callback_notify,
    }
}