/usr/share/puppet/modules.available/puppetlabs-mongodb/manifests/db.pp is in puppet-module-puppetlabs-mongodb 0.7.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # == Class: mongodb::db
#
# Class for creating mongodb databases and users.
#
# == Parameters
#
# user - Database username.
# password_hash - Hashed password. Hex encoded md5 hash of "$username:mongo:$password".
# password - Plain text user password. This is UNSAFE, use 'password_hash' unstead.
# roles (default: ['dbAdmin']) - array with user roles.
# tries (default: 10) - The maximum amount of two second tries to wait MongoDB startup.
#
define mongodb::db (
$user,
$password_hash = false,
$password = false,
$roles = ['dbAdmin'],
$tries = 10,
) {
mongodb_database { $name:
ensure => present,
tries => $tries,
require => Class['mongodb::server'],
}
if $password_hash {
$hash = $password_hash
} elsif $password {
$hash = mongodb_password($user, $password)
} else {
fail("Parameter 'password_hash' or 'password' should be provided to mongodb::db.")
}
mongodb_user { $user:
ensure => present,
password_hash => $hash,
database => $name,
roles => $roles,
require => Mongodb_database[$name],
}
}
|