summaryrefslogtreecommitdiff
path: root/puppet/modules/couchdb/manifests/create_db.pp
diff options
context:
space:
mode:
authorMicah <micah@leap.se>2016-05-24 10:19:27 -0400
committerMicah <micah@leap.se>2016-05-24 10:19:27 -0400
commit8f1fd7c7e042539f3095541b8859276e4dad6629 (patch)
tree864440ba7ce27d8d1fc8d7a504d554bb2fcd2817 /puppet/modules/couchdb/manifests/create_db.pp
parent9721c9eeb21f027456b149764d300a11e301c8ee (diff)
parentaf6fdd31fb961fc1b7f408f51001e7a6d192a58a (diff)
Merge commit 'af6fdd31fb961fc1b7f408f51001e7a6d192a58a' as 'puppet/modules/couchdb'
Diffstat (limited to 'puppet/modules/couchdb/manifests/create_db.pp')
-rw-r--r--puppet/modules/couchdb/manifests/create_db.pp21
1 files changed, 21 insertions, 0 deletions
diff --git a/puppet/modules/couchdb/manifests/create_db.pp b/puppet/modules/couchdb/manifests/create_db.pp
new file mode 100644
index 00000000..8a8d1144
--- /dev/null
+++ b/puppet/modules/couchdb/manifests/create_db.pp
@@ -0,0 +1,21 @@
+define couchdb::create_db (
+ $host='127.0.0.1:5984',
+ $admins="{\"names\": [], \"roles\": [] }",
+ $members="{\"names\": [], \"roles\": [] }" )
+{
+
+ couchdb::query { "create_db_${name}":
+ cmd => 'PUT',
+ host => $host,
+ path => $name,
+ unless => "/usr/bin/curl -s -f --netrc-file /etc/couchdb/couchdb.netrc ${host}/${name}"
+ }
+
+ couchdb::document { "${name}_security":
+ db => $name,
+ id => '_security',
+ host => $host,
+ data => "{ \"admins\": ${admins}, \"members\": ${members} }",
+ require => Couchdb::Query["create_db_${name}"]
+ }
+}