aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2010-12-07 02:40:23 +0000
committerMichael Scherer <misc@mageia.org>2010-12-07 02:40:23 +0000
commit327196eaee37984b6ea264efca7158b2adf5971a (patch)
treed2af050ea60c26801c3e0154564dab237410bbdd /modules
parent63bbb9f955f13b4950bc36a6e18e90f1d748aec1 (diff)
downloadpuppet-327196eaee37984b6ea264efca7158b2adf5971a.tar
puppet-327196eaee37984b6ea264efca7158b2adf5971a.tar.gz
puppet-327196eaee37984b6ea264efca7158b2adf5971a.tar.bz2
puppet-327196eaee37984b6ea264efca7158b2adf5971a.tar.xz
puppet-327196eaee37984b6ea264efca7158b2adf5971a.zip
like the user type, add a database type
Diffstat (limited to 'modules')
-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;"