Puppet Class: mongodb

Defined in:
modules/mongodb/manifests/init.pp

Overview

Class: mongodb

Provisions MongoDB, an open-source document database. See <www.mongodb.org/> for details.

Parameters

dbpath

Set this value to designate a directory for the mongod instance to store its data. Defaults to '/srv/mongod'.

settings

A hash of configuration options. For a full listing of options, see <docs.mongodb.org/manual/reference/configuration-options/>.

Example

class { 'mongodb':
    settings => {
        auth => true,
        port => 29001,
    },
}

Parameters:

  • dbpath (Any) (defaults to: '/srv/mongod')
  • settings (Any) (defaults to: {})


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'modules/mongodb/manifests/init.pp', line 25

class mongodb (
    $dbpath   = '/srv/mongod',
    $settings = {},
) {
    # Base settings required by this Puppet module.
    $required_settings = {
        dbpath      => $dbpath,
        fork        => false,
        logappend   => true,
        logpath     => '/var/log/mongodb/mongodb.log',
    }

    package { 'mongodb':
        ensure => present,
    }

    file { $dbpath:
        ensure  => directory,
        owner   => 'mongodb',
        group   => 'mongodb',
        mode    => '0755',
        require => Package['mongodb'],
    }

    file { '/etc/mongodb.conf':
        content => template('mongodb/mongod.conf.erb'),
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        require => Package['mongodb'],
    }

    service { 'mongodb':
        ensure    => running,
        subscribe => File['/etc/mongodb.conf'],
    }

    base::service_auto_restart { 'mongodb': }
}