summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/add_user.pp15
1 files changed, 15 insertions, 0 deletions
diff --git a/manifests/add_user.pp b/manifests/add_user.pp
new file mode 100644
index 0000000..126c1fa
--- /dev/null
+++ b/manifests/add_user.pp
@@ -0,0 +1,15 @@
+define couchdb::add_user ($host, $roles, $pw ) {
+
+ #exec { "/usr/bin/curl -X PUT $host/_users/org.couchdb.user:$name --data \'{ \"_id\": \"org.couchdb.user:$name\", \"type\": \"user\", \"name\": \"$name\", \"roles\": $roles, \"password\": \"$pw\"}\'":
+ # unless => "/usr/bin/curl -s -X GET $host/_users/org.couchdb.user:$name| grep -qv error",
+ #}
+
+ site_couchdb::query { "create_user_$name":
+ cmd => 'PUT',
+ host => $host,
+ url => "_users/org.couchdb.user:$name",
+ data => "{ \"_id\": \"org.couchdb.user:$name\", \"type\": \"user\", \"name\": \"$name\", \"roles\": $roles, \"password\": \"$pw\"}",
+ }
+
+}
+