wohali/couchdb-cookbook — pull request #29 by anowak (2014-12-10 13:36:42+00:00)
Title: LWRP for creating CouchDB admins

Creation of admin users via the main config file
(i.e. setting `node['couch_db']['config']['admins'][login]`) is
problematic, because after CouchDB hashes the plain text passwords on
start, the file is seen as modified by CouchDB. This in turn causes
unnecessary server restarts on every Chef run.

Using hack similar to https://github.com/wohali/couchdb-cookbook/pull/28
makes CouchDB append the hashes to the 'last file in the config chain',
which means that the Chef-generated file is untouched, but on the other
hand all the passwords are left in clear text.

This LWRP adds separate `local.d` config file for every administrator,
hashing the passwords the same way as CouchDB would, so user creation
finally becomes idempotent.

Example usage:

```
couchdb_admin 'alice' do
password 'secret' # preferably, taken from an encrypted databag
iterations 1000 # 10 is default
end
```