Skip to content

Latest commit

 

History

History
2035 lines (1148 loc) · 55.1 KB

REFERENCE.md

File metadata and controls

2035 lines (1148 loc) · 55.1 KB

Reference

Table of Contents

Classes

Public Classes

Private Classes

  • mongodb::mongos::config: Manages mongos config
  • mongodb::mongos::install: Installs mongos
  • mongodb::mongos::service: Manages the mongos service
  • mongodb::repo: Manages the mongodb repository
  • mongodb::repo::apt: This is a repo class for apt
  • mongodb::repo::yum: This is a repo class for yum
  • mongodb::repo::zypper: This is a repo class for zypper
  • mongodb::server::config: Manages mongod config
  • mongodb::server::install: Manages the mongod package
  • mongodb::server::service: Manages the mongos service

Defined types

  • mongodb::db: Class for creating mongodb databases and users.

Resource types

  • mongodb_conn_validator: Verify that a connection can be successfully established between a node and the mongodb server. Its primary use is as a precondition to prev
  • mongodb_database: Manage MongoDB databases.
  • mongodb_replset: Manage a MongoDB replicaSet
  • mongodb_shard: Manage a MongoDB Shard
  • mongodb_user: Manage a MongoDB user. This includes management of users password as well as privileges.

Functions

Classes

mongodb::client

The mongodb::client class.

Parameters

The following parameters are available in the mongodb::client class:

ensure

Data type: String[1]

Used to ensure that the package is installed, or that the package is absent/purged

Default value: pick($mongodb::globals::client_version, 'present')

package_name

Data type: String[1]

This setting can be used to specify the name of the package that should be installed. If not specified, the module will use whatever service name is the default for your OS distro.

Default value: 'mongodb-mongosh'

mongodb::globals

Class for setting cross-class global overrides.

Examples

Use a specific MongoDB version to install from the community repository.
class {'mongodb::globals':
  manage_package_repo => true,
  repo_version        => '6.0',
}
-> class {'mongodb::client': }
-> class {'mongodb::server': }
Use a specific MongoDB version to install from the enterprise repository.
class {'mongodb::globals':
  manage_package_repo => true,
  repo_version        => '6.0',
  use_enterprise_repo => true,
}
-> class {'mongodb::client': }
-> class {'mongodb::server': }
Use a custom MongoDB apt repository.
class {'mongodb::globals':
  manage_package_repo => true,
  repo_location       => 'https://example.com/repo',
  keyring_location    => 'https://example.com/keyring.asc'
}
-> class {'mongodb::client': }
-> class {'mongodb::server': }
To disable managing of repository, but still enable managing packages.
class {'mongodb::globals':
  manage_package_repo => false,
}
-> class {'mongodb::server': }
-> class {'mongodb::client': }

Parameters

The following parameters are available in the mongodb::globals class:

version

Data type: Optional[String[1]]

The version of MonogDB to install/manage. If not specified, the module will ensure packages with present.

Default value: undef

client_version

Data type: Optional[String[1]]

The version of MongoDB Shell to install/manage. If not specified, the module will ensure packages with present.

Default value: undef

manage_package_repo

Data type: Boolean

Whether to manage MongoDB software repository.

Default value: true

repo_version

Data type: String[1]

The version of the package repo.

Default value: '5.0'

use_enterprise_repo

Data type: Boolean

When manage_package_repo is set to true, this setting indicates if it will use the Community Edition (false, the default) or the Enterprise one (true).

Default value: false

repo_location

Data type: Optional[String]

This setting can be used to override the default MongoDB repository location. If not specified, the module will use the default repository for your OS distro.

Default value: undef

repo_proxy

Data type: Optional[String]

This will allow you to set a proxy for your repository in case you are behind a corporate firewall. Currently this is only supported with yum repositories

Default value: undef

keyring_location

Data type: Optional[String]

When repo_location is used for an apt repository this setting can be used for the keyring file to download.

Default value: undef

proxy_username

Data type: Optional[String]

This sets the username for the proxyserver, should authentication be required.

Default value: undef

proxy_password

Data type: Optional[String]

This sets the password for the proxyserver, should authentication be required

Default value: undef

mongodb::mongos

This class should only be used if you want to implement sharding within your mongodb deployment. This class allows you to configure the mongos daemon (responsible for routing) on your platform.

}

Examples

mongos can be installed the following way.
class {'mongodb::mongos' :
 configdb => ['configsvr1.example.com:27018'],

Parameters

The following parameters are available in the mongodb::mongos class:

config

Data type: Stdlib::Absolutepath

Path of the config file. If not specified, the module will use the default for your OS distro.

Default value: '/etc/mongos.conf'

config_content

Data type: Optional[String[1]]

Config content if the default doesn't match one needs.

Default value: undef

config_template

Data type: Optional[String[1]]

Path to the config template if the default doesn't match one needs.

Default value: undef

configdb

Data type: Variant[String[1], Array[String[1]]]

Array of the config servers IP addresses the mongos should connect to.

Default value: '127.0.0.1:27019'

config_data

Data type: Optional[Hash]

Hash containing key-value pairs to allow for additional configuration options to be set in user-provided template.

Default value: undef

service_manage

Data type: Boolean

Whether or not the MongoDB sharding service resource should be part of the catalog.

Default value: true

service_provider

Data type: Optional[String]

This setting can be used to override the default Mongos service provider. If not specified, the module will use whatever service provider is the default for your OS distro.

Default value: undef

service_name

Data type: String[1]

This setting can be used to override the default Mongos service name. If not specified, the module will use whatever service name is the default for your OS distro.

Default value: 'mongos'

service_user

Data type: String[1]

The user used by Systemd for running the service. If not specified, the module will use the default for your OS distro.

service_group

Data type: String[1]

The group used by Systemd for running the service If not specified, the module will use the default for your OS distro.

service_template

Data type: String[1]

Path to the service template if the default doesn't match one needs.

Default value: 'mongodb/mongos/mongos.service-dropin.epp'

service_enable

Data type: Boolean

This setting can be used to specify if the service should be enable at boot

Default value: true

service_ensure

Data type: Stdlib::Ensure::Service

This setting can be used to specify if the service should be running

Default value: 'running'

service_status

Data type: Optional[String]

This setting can be used to override the default status check command for your Mongos service. If not specified, the module will use whatever service name is the default for your OS distro.

Default value: undef

package_ensure

Data type: String[1]

This setting can be used to specify if puppet should install the package or not

Default value: pick($mongodb::globals::version, 'present')

package_name

Data type: String

This setting can be used to specify the name of the package that should be installed. If not specified, the module will use whatever service name is the default for your OS distro.

Default value: "mongodb-${mongodb::globals::edition}-mongos"

unixsocketprefix

Data type: Stdlib::Absolutepath

The path for the UNIX socket. If this option has no value, the mongos process creates a socket with /tmp as a prefix.

Default value: '/var/run/mongodb'

pidfilepath

Data type: Stdlib::Absolutepath

Specify a file location to hold the PID or process ID of the mongod process. If not specified, the module will use the default for your OS distro.

Default value: '/var/run/mongodb/mongos.pid'

logpath

Data type: Variant[Boolean, Stdlib::Absolutepath]

Specify the path to a file name for the log file that will hold all diagnostic logging information. Unless specified, mongod will output all log information to the standard output.

Default value: '/var/log/mongodb/mongos.log'

fork

Data type: Boolean

Set to true to fork server process at launch time. The default setting depends on the operating system.

Default value: true

bind_ip

Data type: Optional[Array[Stdlib::IP::Address]]

Set this option to configure the mongod or mongos process to bind to and listen for connections from applications on this address. If not specified, the module will use the default for your OS distro.

Default value: undef

port

Data type: Optional[Stdlib::Port]

Specifies a TCP port for the server instance to listen for client connections.

Default value: undef

restart

Data type: Boolean

Specifies whether the service should be restarted on config changes.

Default value: true

mongodb::opsmanager

The mongodb::opsmanager class.

Parameters

The following parameters are available in the mongodb::opsmanager class:

pem_key_password

Data type: Optional[String[1]]

The password to the pem key file.

Default value: undef

user_svc_class

Data type: Optional[String[1]]

The user svc class Default: com.xgen.svc.mms.svc.user.UserSvcDb External Source: com.xgen.svc.mms.svc.user.UserSvcCrowd Internal Database: com.xgen.svc.mms.svc.user.UserSvcDb

Default value: undef

snapshot_interval

Data type: Optional[Integer]

The snapshot interval to use

Default value: undef

snapshot_interval_retention

Data type: Optional[Integer]

The snapshot interval retention period

Default value: undef

snapshot_daily_retention

Data type: Optional[Integer]

The dayly snapshot interval retention period

Default value: undef

snapshot_weekly_retention

Data type: Optional[Integer]

The weekly snapshot interval retention period

Default value: undef

snapshot_monthly_retention

Data type: Optional[Integer]

The monthly snapshot interval retention period

Default value: undef

versions_directory

Data type: Optional[Integer]

The directory where to store the snapshot versions

Default value: undef

user

Data type: String[1]

Default value: 'mongodb-mms'

group

Data type: String[1]

Default value: 'mongodb-mms'

ensure

Data type: Enum['running', 'stopped']

Default value: 'running'

package_name

Data type: String[1]

Default value: 'mongodb-mms'

package_ensure

Data type: String[1]

Default value: 'present'

service_enable

Data type: Boolean

Default value: true

service_manage

Data type: Boolean

Default value: true

service_name

Data type: String[1]

Default value: 'mongodb-mms'

download_url

Data type: Stdlib::Httpurl

Default value: 'https://downloads.mongodb.com/on-prem-mms/rpm/mongodb-mms-4.0.1.50101.20180801T1117Z-1.x86_64.rpm'

mongo_uri

Data type: String[1]

Default value: 'mongodb://127.0.0.1:27017'

opsmanager_url

Data type: Stdlib::Httpurl

Default value: "http://${facts['networking']['fqdn']}:8080"

client_certificate_mode

Data type: String[1]

Default value: 'None'

from_email_addr

Data type: String[1]

Default value: 'from@example.com'

reply_to_email_addr

Data type: String[1]

Default value: 'reply-to@example.com'

admin_email_addr

Data type: String[1]

Default value: 'admin@example.com'

email_dao_class

Data type: String[1]

Default value: 'com.xgen.svc.core.dao.email.JavaEmailDao'

mail_transport

Data type: Enum['smtp','smtps']

Default value: 'smtp'

smtp_server_hostname

Data type: Stdlib::Host

Default value: 'smtp.example.com'

smtp_server_port

Data type: Stdlib::Port

Default value: 25

ssl

Data type: Boolean

Default value: false

ignore_ui_setup

Data type: Boolean

Default value: true

ca_file

Data type: Optional[String[1]]

Default value: undef

pem_key_file

Data type: Optional[String[1]]

Default value: undef

mongodb::replset

Wrapper class useful for hiera based deployments

Examples

hieradata
mongodb::replset::sets:
  replicaset01:
    ensure: present
    members:
      - member01.example.com:27017
      - member02.example.com:27017
      - member03.example.com:27017

Parameters

The following parameters are available in the mongodb::replset class:

sets

Data type: Any

Hash of attributes as described in the mongodb_replset custom type

Default value: undef

mongodb::server

Most of the parameters manipulate the mongod.conf file.

For more details about configuration parameters consult the MongoDB Configuration File Options.

This setting can be used to specify if the service should be running.

Parameters

The following parameters are available in the mongodb::server class:

ensure

Data type: String[1]

Used to ensure that the package is installed and the service is running, or that the package is absent/purged and the service is stopped.

Default value: 'present'

user

Data type: String[1]

This setting can be used to override the default MongoDB user and owner of the service and related files in the file system. If not specified, the module will use the default for your OS distro.

group

Data type: String[1]

This setting can be used to override the default MongoDB user group to be used for related files in the file system. If not specified, the module will use the default for your OS distro.

config

Data type: Stdlib::Absolutepath

Path of the config file. If not specified, the module will use the default for your OS distro.

Default value: '/etc/mongod.conf'

dbpath

Data type: Stdlib::Absolutepath

Set this value to designate a directory for the mongod instance to store it's data. If not specified, the module will use the default for your OS distro.

dbpath_fix

Data type: Boolean

Set this value to true if you want puppet to recursively manage the permissions of the files in the dbpath directory. If you are using the default dbpath, this should probably be false. Set this to true if you are using a custom dbpath.

Default value: false

pidfilemode

Data type: String[4,4]

The file mode of the pidfilepath

Default value: '0644'

pidfilepath

Data type: Optional[Stdlib::Absolutepath]

Specify a file location to hold the PID or process ID of the mongod process. If not specified, the module will use the default for your OS distro.

Default value: undef

manage_pidfile

Data type: Boolean

Should puppet create the pidfile. Mongod 6.2.10 will not start if pidfile exists

Default value: false

rcfile

Data type: String

The path to the custom mongosh rc file.

Default value: "${facts['root_home']}/.mongoshrc.js"

service_manage

Data type: Boolean

Whether or not the MongoDB service resource should be part of the catalog.

Default value: true

service_manage

Whether or not the MongoDB sharding service resource should be part of the catalog.

Default value: true

service_name

Data type: String[1]

This setting can be used to override the default Mongos service name. If not specified, the module will use whatever service name is the default for your OS distro.

Default value: 'mongod'

service_provider

Data type: Optional[String[1]]

This setting can be used to override the default Mongos service provider. If not specified, the module will use whatever service provider is the default for your OS distro.

Default value: undef

service_status

Data type: Optional[Enum['stopped', 'running']]

This setting can be used to override the default status check command for your Mongos service. If not specified, the module will use whatever service name is the default for your OS distro.

Default value: undef

service_enable

Data type: Boolean

This setting can be used to specify if the service should be enable at boot.

Default value: true

service_ensure

Data type: Enum['stopped', 'running']

Default value: 'running'

package_ensure

Data type: String[1]

This setting can be used to specify if puppet should install the package or not.

Default value: pick($mongodb::globals::version, 'present')

package_name

Data type: String[1]

This setting can be used to specify the name of the package that should be installed. If not specified, the module will use whatever service name is the default for your OS distro.

Default value: "mongodb-${mongodb::globals::edition}-server"

logpath

Data type: Stdlib::Absolutepath

Specify the path to a file name for the log file that will hold all diagnostic logging information. Unless specified, mongod will output all log information to the standard output.

Default value: '/var/log/mongodb/mongod.log'

bind_ip

Data type: Array[Stdlib::IP::Address]

Set this option to configure the mongod or mongos process to bind to and listen for connections from applications on this address. If not specified, the module will use the default for your OS distro.

Default value: ['127.0.0.1']

ipv6

Data type: Optional[Boolean]

This setting has to be true to configure MongoDB to turn on ipv6 support. If not specified and ipv6 address is passed to MongoDB bind_ip it will just fail.

Default value: undef

logappend

Data type: Boolean

Set to true to add new entries to the end of the logfile rather than overwriting the content of the log when the process restarts.

Default value: true

system_logrotate

Data type: Optional[String]

Set to reopen for mongo to close a log file then reopen it so that logrotations handled outside of mongo perform as expected.

Default value: undef

fork

Data type: Optional[Boolean]

Set to true to fork server process at launch time. The default setting depends on the operating system.

Default value: undef

port

Data type: Optional[Integer[1, 65535]]

Specifies a TCP port for the server instance to listen for client connections.

Default value: undef

journal

Data type: Optional[Boolean]

Enable or disable the durability journal to ensure data files remain valid and recoverable. Available in MongoDB < 7.0 Default: true on 64-bit systems, false on 32-bit systems

Default value: undef

smallfiles

Data type: Optional[Boolean]

Set to true to modify MongoDB to use a smaller default data file size. Specifically, smallfiles reduces the initial size for data files and limits them to 512 megabytes.

Default value: undef

cpu

Data type: Optional[Boolean]

Set to true to force mongod to report every four seconds CPU utilization and the amount of time that the processor waits for I/O operations to complete (i.e. I/O wait.)

Default value: undef

auth

Data type: Boolean

Set to true to enable database authentication for users connecting from remote hosts. If no users exist, the localhost interface will continue to have access to the database until you create the first user.

Default value: false

verbose

Data type: Optional[Boolean]

Increases the amount of internal reporting returned on standard output or in the log file generated by logpath.

Default value: undef

verbositylevel

Data type: Optional[String]

MongoDB has the following levels of verbosity: v, vv, vvv, vvvv and vvvvv.

Default value: undef

objcheck

Data type: Optional[Boolean]

Forces the mongod to validate all requests from clients upon receipt to ensure that clients never insert invalid documents into the database.

Default value: undef

quota

Data type: Optional[Boolean]

Set to true to enable a maximum limit for the number of data files each database can have. The default quota is 8 data files, when quota is true.

Default value: undef

quotafiles

Data type: Optional[Integer]

Modify limit on the number of data files per database. This option requires the quota setting.

Default value: undef

diaglog

Data type: Optional[Integer[0, 7]]

Creates a very verbose diagnostic log for troubleshooting and recording various errors. For more information please refer to MongoDB Configuration File Options.

Default value: undef

directoryperdb

Data type: Optional[Boolean]

Set to true to modify the storage pattern of the data directory to store each database’s files in a distinct folder.

Default value: undef

profile

Data type: Any

Modify this value to changes the level of database profiling, which inserts information about operation performance into output of mongod or the log file if specified by logpath.

Default value: undef

maxconns

Data type: Optional[Integer]

Specifies a value to set the maximum number of simultaneous connections that MongoDB will accept. Unless set, MongoDB will not limit its own connections.

Default value: undef

oplog_size

Data type: Optional[Integer]

Specifies a maximum size in megabytes for the replication operation log (e.g. oplog.) mongod creates an oplog based on the maximum amount of space available. For 64-bit systems, the oplog is typically 5% of available disk space.

Default value: undef

nohints

Data type: Any

Ignore query hints.

Default value: undef

nohttpinterface

Data type: Optional[Boolean]

Set to true to disable the HTTP interface. This command will override the rest and disable the HTTP interface if you specify both.

Default value: undef

noscripting

Data type: Optional[Boolean]

Set noscripting = true to disable the scripting engine.

Default value: undef

notablescan

Data type: Optional[Boolean]

Set notablescan = true to forbid operations that require a table scan.

Default value: undef

noprealloc

Data type: Optional[Boolean]

Set noprealloc = true to disable the preallocation of data files. This will shorten the start up time in some cases, but can cause significant performance penalties during normal operations.

Default value: undef

nssize

Data type: Optional[Integer]

Use this setting to control the default size for all newly created namespace files (i.e .ns).

Default value: undef

mms_token

Data type: Any

MMS token for mms monitoring.

Default value: undef

mms_name

Data type: Any

MMS identifier for mms monitoring.

Default value: undef

mms_interval

Data type: Any

MMS interval for mms monitoring.

Default value: undef

replset

Data type: Optional[String]

Use this setting to configure replication with replica sets. Specify a replica set name as an argument to this set. All hosts must have the same set name.

Default value: undef

replset_config

Data type: Optional[Hash]

A hash that is used to configure the replica set. Mutually exclusive with replset_members param. class mongodb::server { replset => 'rsmain', replset_config => { 'rsmain' => { ensure => present, settings => { heartbeatTimeoutSecs => 15, getLastErrorModes => { ttmode => { dc => 1 } } }, members => [{'host' => 'host1:27017', 'tags':{ 'dc' : 'east'}}, { 'host' => 'host2:27017'}, 'host3:27017'] }}, }

Default value: undef

replset_members

Data type: Optional[Array]

An array of member hosts for the replica set. Mutually exclusive with replset_config param.

Default value: undef

configsvr

Data type: Optional[Boolean]

Use this setting to enable config server mode for mongod.

Default value: undef

shardsvr

Data type: Optional[Boolean]

Use this setting to enable shard server mode for mongod.

Default value: undef

rest

Data type: Optional[Boolean]

Set to true to enable a simple REST interface.

Default value: undef

quiet

Data type: Optional[Boolean]

Runs the mongod or mongos instance in a quiet mode that attempts to limit the amount of output. This option suppresses : "output from database commands, including drop, dropIndexes, diagLogging, validate, and clean", "replication activity", "connection accepted events" and "connection closed events".

For production systems this option is not recommended as it may make tracking problems during particular connections much more difficult.

Default value: undef

slowms

Data type: Optional[Integer]

Sets the threshold for mongod to consider a query “slow” for the database profiler.

Default value: undef

keyfile

Data type: Optional[Stdlib::Absolutepath]

Specify the path to a key file to store authentication information. This option is only useful for the connection between replica set members.

Default value: undef

key

Data type: Optional[Variant[String[6], Sensitive[String[6]]]]

Specify the key contained within the keyfile. This option is only useful for the connection between replica set members.

Default value: undef

set_parameter

Data type: Optional[Variant[String[1], Array[String[1]], Hash]]

Set MongoDB parameters Supported types: String (i.e. 'textSearchEnabled=true' or 'textSearchEnabled: true' ) Array (i.e. ['textSearchEnabled=true'] or ['textSearchEnabled: true'] ) Hash (i.e. {'textSearchEnabled' => true}

Default value: undef

syslog

Data type: Boolean

Sends all logging output to the host’s syslog system rather than to standard output or a log file.

Default value: false

config_content

Data type: Any

Config content if the default doesn't match one needs.

Default value: undef

config_template

Data type: Optional[String]

Path to the config template if the default doesn't match one needs.

Default value: undef

config_data

Data type: Optional[Hash]

A hash to allow for additional configuration options to be set. (i.e {'security' => { 'javascriptEnabled' => false}})

Default value: undef

tls

Data type: Boolean

Ensure tls is enabled.

Default value: false

tls_key

Data type: Optional[Stdlib::Absolutepath]

Defines the path of the file that contains the TLS/SSL certificate and key.

Default value: undef

tls_ca

Data type: Optional[Stdlib::Absolutepath]

Defines the path of the file that contains the certificate chain for verifying client certificates.

Default value: undef

tls_conn_without_cert

Data type: Optional[Boolean]

Set to true to bypass client certificate validation for clients that do not present a certificate.

Default value: undef

tls_invalid_hostnames

Data type: Optional[Boolean]

Set to true to disable the validation of the hostnames in TLS certificates.

Default value: undef

tls_invalid_certificates

Data type: Optional[Boolean]

Enable or disable the validation checks for TLS certificates on other servers in the cluster and allows the use of invalid certificates to connect.

Default value: undef

tls_mode

Data type: Enum['requireTLS', 'preferTLS', 'allowTLS']

Defines if TLS is used for all network connections. Allowed values are 'requireTLS', 'preferTLS' or 'allowTLS'.

Default value: 'requireTLS'

admin_password_hash

Data type: Optional[Variant[String[1], Sensitive[String[1]]]]

Hashed password. Hex encoded md5 hash of mongodb password.

Default value: undef

restart

Data type: Boolean

Specifies whether the service should be restarted on config changes.

Default value: true

storage_engine

Data type: Optional[String]

Only needed for MongoDB 3.x versions, where it's possible to select the 'wiredTiger' engine in addition to the default 'mmapv1' engine. If not set, the config is left out and mongo will default to 'mmapv1'.

Default value: undef

create_admin

Data type: Boolean

Allows to create admin user for admin database.

Default value: false

admin_username

Data type: String

Administrator user name

Default value: 'admin'

admin_password

Data type: Optional[Variant[String, Sensitive[String]]]

Administrator user password

Default value: undef

admin_auth_mechanism

Data type: Enum['scram_sha_1', 'scram_sha_256']

Administrator authentication mechanism. scram_sha_256 password synchronization verification is not supported.

Default value: 'scram_sha_1'

admin_update_password

Data type: Boolean

Update password. Used with SCRAM-SHA-256 because password verification is not supported.

Default value: false

admin_roles

Data type: Array[String[1]]

Administrator user roles

Default value:

[
    'userAdmin', 'readWrite', 'dbAdmin', 'dbAdminAnyDatabase', 'readAnyDatabase',
    'readWriteAnyDatabase', 'userAdminAnyDatabase', 'clusterAdmin',
    'clusterManager', 'clusterMonitor', 'hostManager', 'root', 'restore',
  ]
handle_creds

Data type: Boolean

Set this to false to avoid having puppet handle .mongoshrc.js in case you wish to deliver it by other means. This is needed for facts and providers to work if you have auth set to true.

Default value: true

store_creds

Data type: Boolean

Store admin credentials in mongoshrc.js file. Uses with create_admin parameter

Default value: false

mongodb::shardsvr

Wrapper class useful for hiera based deployments

Examples

hieradata
mongodb::shardsvr::shards:
  shard01:
    keys:
      - {x: 1}
    members:
      - shardhost01.exmaple.com:30000
      - shardhost02.exmaple.com:30000
      - shardhost03.exmaple.com:30000

Parameters

The following parameters are available in the mongodb::shardsvr class:

shards

Data type: Any

Hash of attributes as described in the mongodb_shardsvr custom type

Default value: undef

Defined types

mongodb::db

Class for creating mongodb databases and users.

Parameters

The following parameters are available in the mongodb::db defined type:

user

Data type: String

Database username.

auth_mechanism

Data type: Enum['scram_sha_1', 'scram_sha_256']

Authentication mechanism. scram_sha_256 password verification is not supported. Defaults to 'scram_sha_1'.

Default value: 'scram_sha_1'

db_name

Data type: String

Database name. Defaults to $name.

Default value: $name

password_hash

Data type: Optional[Variant[String[1], Sensitive[String[1]]]]

Hashed password. Hex encoded md5 hash of "$username:mongo:$password".

Default value: undef

password

Data type: Optional[Variant[String[1], Sensitive[String[1]]]]

Plain text user password. This is UNSAFE, use 'password_hash' instead.

Default value: undef

roles

Data type: Array[String]

Array with user roles. Deaults to ['dbAdmin']

Default value: ['dbAdmin']

tries

Data type: Integer[0]

The maximum amount of two second tries to wait MongoDB startup. Defaults to 10.

Default value: 10

update_password

Data type: Boolean

Force an update of the password when scram_sha_256 is used. Defaults to false.

Default value: false

Resource types

mongodb_conn_validator

Verify that a connection can be successfully established between a node and the mongodb server. Its primary use is as a precondition to prevent configuration changes from being applied if the mongodb server cannot be reached, but it could potentially be used for other purposes such as monitoring.

Properties

The following properties are available in the mongodb_conn_validator type.

ensure

Valid values: present, absent

Ensure to verify the connection to mongodb

Default value: present

Parameters

The following parameters are available in the mongodb_conn_validator type.

name

namevar

An arbitrary name used as the identity of the resource. It can also be the connection string to test (ie. 127.0.0.1:27017)

port

The port that the mongodb server should be listening on.

Default value: 27017

provider

The specific backend to use for this mongodb_conn_validator resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform.

server

An array containing DNS names or IP addresses of the server where mongodb should be running.

Default value: 127.0.0.1

timeout

The max number of seconds that the validator should wait before giving up and deciding that puppetdb is not running; defaults to 60 seconds.

Default value: 60

mongodb_database

Manage MongoDB databases.

Properties

The following properties are available in the mongodb_database type.

ensure

Valid values: present, absent

The basic property that the resource should be in.

Default value: present

Parameters

The following parameters are available in the mongodb_database type.

name

Valid values: %r{^[\w-]+$}

namevar

The name of the database.

provider

The specific backend to use for this mongodb_database resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform.

tries

Valid values: %r{^\d+$}

The maximum amount of two second tries to wait MongoDB startup.

Default value: 10

mongodb_replset

Manage a MongoDB replicaSet

Properties

The following properties are available in the mongodb_replset type.

ensure

Valid values: present

Ensure the replicaset is either present or absent

Default value: present

members

The replicaSet members config

settings

The replicaSet settings config

Parameters

The following parameters are available in the mongodb_replset type.

arbiter

The replicaSet arbiter

initialize_host

Host to use for Replicaset initialization

Default value: 127.0.0.1

name

namevar

The name of the replicaSet

provider

The specific backend to use for this mongodb_replset resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform.

mongodb_shard

Manage a MongoDB Shard

Properties

The following properties are available in the mongodb_shard type.

ensure

Valid values: present

Ensure the shard is either present or absent

Default value: present

keys

The sharding keys

member

The shard member

Parameters

The following parameters are available in the mongodb_shard type.

name

namevar

The name of the shard

provider

The specific backend to use for this mongodb_shard resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform.

mongodb_user

Manage a MongoDB user. This includes management of users password as well as privileges.

Properties

The following properties are available in the mongodb_user type.

database

Valid values: %r{^[\w-]+$}

The user's target database.

ensure

Valid values: present, absent

The basic property that the resource should be in.

Default value: present

password

The plaintext password of the user.

password_hash

Valid values: %r{^\w+$}

The password hash of the user. Use mongodb_password() for creating hash. Only available on MongoDB 3.0 and later. SCRAM-SHA-256 authentication mechanism is not supported.

roles

Valid values: %r{^\w+(@\w+)?$}

The user's roles.

Default value: ['dbAdmin']

scram_credentials

The SCRAM-SHA-1 credentials of a user. These are read only and change when password or password_hash changes.

username

The name of the user.

Parameters

The following parameters are available in the mongodb_user type.

auth_mechanism

Valid values: scram_sha_256, scram_sha_1

Authentication mechanism. Password verification is not supported with SCRAM-SHA-256.

Default value: scram_sha_1

name

namevar

The name of the resource.

provider

The specific backend to use for this mongodb_user resource. You will seldom need to specify this --- Puppet will usually discover the appropriate provider for your platform.

tries

Valid values: %r{^\d+$}

The maximum amount of two second tries to wait MongoDB startup.

Default value: 10

update_password

Update password. Used with SCRAM-SHA-256 because password verification is not supported.

Default value: false

Functions

mongodb_password

Type: Ruby 4.x API

Get the mongodb password hash from the clear text password.

mongodb_password(String[1] $username, Variant[String[1], Sensitive[String[1]]] $password, Optional[Boolean] $sensitive)

Get the mongodb password hash from the clear text password.

Returns: Variant[String, Sensitive[String]]

username

Data type: String[1]

password

Data type: Variant[String[1], Sensitive[String[1]]]

sensitive

Data type: Optional[Boolean]