[Mageia-sysadm] [525] like the user type, add a database type

root at mageia.org root at mageia.org
Tue Dec 7 03:40:24 CET 2010


Revision: 525
Author:   misc
Date:     2010-12-07 03:40:23 +0100 (Tue, 07 Dec 2010)
Log Message:
-----------
like the user type, add a database type

Modified Paths:
--------------
    puppet/modules/postgresql/manifests/init.pp

Modified: puppet/modules/postgresql/manifests/init.pp
===================================================================
--- puppet/modules/postgresql/manifests/init.pp	2010-12-07 02:40:22 UTC (rev 524)
+++ puppet/modules/postgresql/manifests/init.pp	2010-12-07 02:40:23 UTC (rev 525)
@@ -68,6 +68,14 @@
         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;"
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101207/97c35e94/attachment.html>


More information about the Mageia-sysadm mailing list