summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/create_db.pp20
1 files changed, 20 insertions, 0 deletions
diff --git a/manifests/create_db.pp b/manifests/create_db.pp
new file mode 100644
index 0000000..112e094
--- /dev/null
+++ b/manifests/create_db.pp
@@ -0,0 +1,20 @@
+define couchdb::create_db ($host,
+ $admins="{\"names\": [], \"roles\": [] }",
+ $readers="{\"names\": [], \"roles\": [] }") {
+
+ Site_couchdb::Query["create_db_$name"] -> Site_couchdb::Query["db_security_${name}"]
+
+ site_couchdb::query { "create_db_$name":
+ cmd => 'PUT',
+ host => $host,
+ url => $name,
+ }
+
+ site_couchdb::query { "db_security_${name}":
+ cmd => 'PUT',
+ host => $host,
+ url => "$name/_security",
+ data => "{ \"admins\": $admins, \"readers\": $readers }"
+ }
+
+}