aboutsummaryrefslogtreecommitdiffstats
path: root/modules/postgresql
diff options
context:
space:
mode:
Diffstat (limited to 'modules/postgresql')
-rw-r--r--modules/postgresql/manifests/init.pp9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/postgresql/manifests/init.pp b/modules/postgresql/manifests/init.pp
index 5e758dbd..9b9e3b18 100644
--- a/modules/postgresql/manifests/init.pp
+++ b/modules/postgresql/manifests/init.pp
@@ -67,4 +67,13 @@ class postgresql {
content => template("postgresql/pg_ident.conf"),
require => Package["postgresql-server"],
}
+
+ define user($password) {
+ $sql = "CREATE ROLE $name ENCRYPTED PASSWORD '$password' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;"
+
+ exec { "psql -U postgres -c \"$sql\" ":
+ user => root,
+ unless => "psql -A -t -U postgres -c '\du $name' | grep '$name'",
+ }
+ }
}