Defined Type: mongodb::conf

Defined in:
manifests/conf.pp

Overview

Define: mongodb::conf

With this define you can manage any mongodb configuration file

Parameters

template

String. Optional. Default: undef. Alternative to: source, content. Sets the module path of a custom template to use as content of the config file When defined, config file has: content => content($template), Example: template => ‘site/mongodb/my.conf.erb’,

content

String. Optional. Default: undef. Alternative to: template, source. Sets directly the value of the file’s content parameter When defined, config file has: content => $content, Example: content => “# File manage by Puppet n”,

source

String. Optional. Default: undef. Alternative to: template, content. Sets the value of the file’s source parameter When defined, config file has: source => $source, Example: source => ‘puppet:///site/mongodb/my.conf’,

ensure

String. Default: present Manages config file presence. Possible values:

  • ‘present’ - Create and manages the file.

  • ‘absent’ - Remove the file.

path

String. Optional. Default: $config_dir/$title The path of the created config file. If not defined a file name like the the name of the title a custom template to use as content of configfile If defined, configfile file has: content => content(“$template”)

mode
owner
group
config_file_require
replace

String. Optional. Default: undef All these parameters map directly to the created file attributes. If not defined the module’s defaults are used. If defined, config file file has, for example: mode => $mode

config_file_notify

String. Optional. Default: ‘class_default’ Defines the notify argument of the created file. The default special value implies the same behaviour of the main class configuration file. Set to undef to remove any notify, or set the name(s) of the resources to notify

options_hash

Hash. Default undef. Needs: ‘template’. An hash of custom options to be used in templates to manage any key pairs of arbitrary settings.

Parameters:

  • source (Any) (defaults to: undef)
  • template (Any) (defaults to: undef)
  • content (Any) (defaults to: undef)
  • path (Any) (defaults to: undef)
  • mode (Any) (defaults to: undef)
  • owner (Any) (defaults to: undef)
  • group (Any) (defaults to: undef)
  • config_file_notify (Any) (defaults to: 'class_default')
  • config_file_require (Any) (defaults to: undef)
  • options_hash (Any) (defaults to: undef)
  • ensure (Any) (defaults to: present)


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'manifests/conf.pp', line 61

define mongodb::conf (

  $source       = undef,
  $template     = undef,
  $content      = undef,

  $path         = undef,
  $mode         = undef,
  $owner        = undef,
  $group        = undef,

  $config_file_notify  = 'class_default',
  $config_file_require = undef,

  $options_hash = undef,

  $ensure       = present ) {

  validate_re($ensure, ['present','absent'], 'Valid values are: present, absent. WARNING: If set to absent the conf file is removed.')

  include mongodb

  $manage_path    = pickx($path, "${mongodb::config_dir_path}/${name}")
  $manage_content = default_content($content, $template)
  $manage_mode    = pickx($mode, $mongodb::config_file_mode)
  $manage_owner   = pickx($owner, $mongodb::config_file_owner)
  $manage_group   = pickx($group, $mongodb::config_file_group)
  $manage_require = pickx($config_file_require, $mongodb::config_file_require)
  $manage_notify  = $config_file_notify ? {
    'class_default' => $mongodb::manage_config_file_notify,
    default         => $config_file_notify,
  }

  file { "mongodb_conf_${name}":
    ensure  => $ensure,
    source  => $source,
    content => $manage_content,
    path    => $manage_path,
    mode    => $manage_mode,
    owner   => $manage_owner,
    group   => $manage_group,
    require => $manage_require,
    notify  => $manage_notify,
  }

}