diff options
Diffstat (limited to 'manifests/create_db.pp')
-rw-r--r-- | manifests/create_db.pp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/manifests/create_db.pp b/manifests/create_db.pp new file mode 100644 index 00000000..8a8d1144 --- /dev/null +++ b/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}"] + } +} |