summaryrefslogtreecommitdiff
path: root/manifests/add_user.pp
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2012-11-03 21:46:43 +0100
committervarac <varacanero@zeromail.org>2012-11-03 21:46:43 +0100
commitb7ed2ad302b03a564db473220728ecfa4d2a09fc (patch)
treeaf691ae1bac76cd647954a3194a6de06d84af651 /manifests/add_user.pp
parentfd8c6d9481910d7ee587cbd1098346da868f5068 (diff)
added add_user.pp
Diffstat (limited to 'manifests/add_user.pp')
-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\"}",
+ }
+
+}
+