aboutsummaryrefslogtreecommitdiffstats
path: root/modules/postgresql/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/postgresql/manifests')
-rw-r--r--modules/postgresql/manifests/init.pp8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/postgresql/manifests/init.pp b/modules/postgresql/manifests/init.pp
index 9b9e3b18..6765c7e5 100644
--- a/modules/postgresql/manifests/init.pp
+++ b/modules/postgresql/manifests/init.pp
@@ -68,6 +68,14 @@ class postgresql {
require => Package["postgresql-server"],
}
+ # TODO convert it to a regular type ( so we can later change user and so on )
+ define database($description="", $user="postgres") {
+ exec { "createdb -U postgres $name '$description'":
+ user => root,
+ unless => "psql -l -U postgres | grep '^$name|'",
+ }
+ }
+
define user($password) {
$sql = "CREATE ROLE $name ENCRYPTED PASSWORD '$password' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;"