Add mongodb module
This commit is contained in:
parent
72c344aa6e
commit
8312944a50
2 changed files with 61 additions and 0 deletions
48
mongodb/manifests/init.pp
Normal file
48
mongodb/manifests/init.pp
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Install mongodb server.
|
||||
#
|
||||
class mongodb($datadir='/srv/mongodb') {
|
||||
|
||||
package { [
|
||||
'mongodb',
|
||||
'mongodb-server',
|
||||
]:
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
if $datadir != '/srv/mongodb' {
|
||||
file { '/srv/mongodb':
|
||||
ensure => link,
|
||||
target => $datadir,
|
||||
}
|
||||
}
|
||||
|
||||
file { $datadir:
|
||||
ensure => directory,
|
||||
mode => '0770',
|
||||
owner => 'mongodb',
|
||||
group => 'mongodb',
|
||||
require => Package['mongodb-server'],
|
||||
}
|
||||
|
||||
if versioncmp($::operatingsystemrelease, "7") >= 0 {
|
||||
$config = '/etc/mongod.conf'
|
||||
} else {
|
||||
$config = '/etc/mongodb.conf'
|
||||
}
|
||||
|
||||
file { $config:
|
||||
ensure => present,
|
||||
mode => '0644',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
source => 'puppet:///modules/mongodb/mongod.conf',
|
||||
notify => Service['mongod'],
|
||||
}
|
||||
|
||||
service { 'mongod':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => File['/srv/mongodb'],
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue