Forge Home


Puppet module for mongodb


8,964 latest version

0.4 quality score

Version information

  • 2.0.15 (latest)
  • 2.0.14
  • 2.0.13
  • 2.0.12
  • 2.0.11
released Apr 26th 2015
This module has been deprecated by its author since Oct 28th 2019.

The reason given was: No longer maintained

The author has suggested puppet-mongodb as its replacement.

Start using this module


example42/mongodb — version 2.0.15 Apr 26th 2015


####Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Operating Systems Support
  6. Development


This module installs, manages and configures mongodb.

##Module Description

The module is based on stdmod naming standards version 0.9.0.

Refer to for complete documentation on the common parameters.


###Resources managed by mongodb module

  • This module installs the mongodb package
  • Enables the mongodb service
  • Can manage all the configuration files (by default no file is changed)

###Setup Requirements

###Beginning with module mongodb

To install the package provided by the module just include it:

    include mongodb

The main class arguments can be provided either via Hiera (from Puppet 3.x) or direct parameters:

    class { 'mongodb':
      parameter => value,

The module provides a generic define to manage any mongodb configuration file:

    mongodb::conf { 'sample.conf':
      content => '# Test',

To create and manage users:

    mongodb::user { 'joe':
      password => 'S$cr£t',


  • A common way to use this module involves the management of the main configuration file via a custom template (provided in a custom site module):

      class { 'mongodb':
        config_file_template => 'site/mongodb/mongodb.conf.erb',
  • You can write custom templates that use setting provided but the config_file_options_hash paramenter

      class { 'mongodb':
        config_file_template      => 'site/mongodb/mongodb.conf.erb',
        config_file_options_hash  => {
          opt  => 'value',
          opt2 => 'value2',
  • Use custom source (here an array) for main configuration file. Note that template and source arguments are alternative.

      class { 'mongodb':
        config_file_source => [ "puppet:///modules/site/mongodb/mongodb.conf-${hostname}" ,
                                "puppet:///modules/site/mongodb/mongodb.conf" ],
  • Use custom source directory for the whole configuration directory, where present.

      class { 'mongodb':
        config_dir_source  => 'puppet:///modules/site/mongodb/conf/',
  • Use custom source directory for the whole configuration directory and purge all the local files that are not on the dir. Note: This option can be used to be sure that the content of a directory is exactly the same you expect, but it is desctructive and may remove files.

      class { 'mongodb':
        config_dir_source => 'puppet:///modules/site/mongodb/conf/',
        config_dir_purge  => true, # Default: false.
  • Use custom source directory for the whole configuration dir and define recursing policy.

      class { 'mongodb':
        config_dir_source    => 'puppet:///modules/site/mongodb/conf/',
        config_dir_recursion => false, # Default: true.
  • Provide an hash of files resources to be created with mongodb::conf.

      class { 'mongodb':
        conf_hash => {
          'mongodb.conf' => {
            template => 'site/mongodb/mongodb.conf',
          'mongodb.other.conf' => {
            template => 'site/mongodb/mongodb.other.conf',
  • Do not trigger a service restart when a config file changes.

      class { 'mongodb':
        config_dir_notify => '', # Default: Service[mongodb]
  • Install only the mongodb client (by defalut both server and client are installed

      class { 'mongodb':
        server_package_name => '',
  • Use 10gen repository

      class { 'mongodb':
        repo_class => 'mongodb::repo::10gen',

##Operating Systems Support

This is tested on these OS:

  • RedHat osfamily 5 and 6
  • Debian 6 and 7
  • Ubuntu 10.04 and 12.04


Pull requests (PR) and bug reports via GitHub are welcomed.

When submitting PR please follow these quidelines:

  • Provide puppet-lint compliant code
  • If possible provide rspec tests
  • Follow the module style and stdmod naming standards

When submitting bug report please include or link:

  • The Puppet code that triggers the error
  • The output of facter on the system where you try it
  • All the relevant error logs
  • Any other information useful to undestand the context