puppet-mongodb icon indicating copy to clipboard operation
puppet-mongodb copied to clipboard

Example for set_parameters

Open CostelloC opened this issue 4 years ago • 5 comments

Can't seem to work out how to add an additional parameter under 'set_parameters' set_parameter => 'authenticationMechanisms: SCRAM-SHA-1', set_parameter => 'authenticationMechanisms= SCRAM-SHA-1', Is there an example?

What are you seeing

setParameter is of type StringMap, but value in YAML config is not a map type

CostelloC avatar Apr 21 '20 16:04 CostelloC

That depends on whether you use Hiera or the Puppet DSL.

Hiera:

mongodb::server::set_parameter: 'authenticationMechanisms=SCRAM-SHA-1'

Puppet:

class { ‘mongodb::server:
  set_parameter => 'authenticationMechanisms=SCRAM-SHA-1',
}

Please provide more infos, if this does not work. I never used this module. 🤓

dhoppe avatar Apr 21 '20 19:04 dhoppe

Thanks @dhoppe, I'm using puppetDSL it looks like, this is the full class I use

-> class {'mongodb::server':
    ensure => present,
    port    => 27000,
    dbpath => '/data',
    dbpath_fix => true,
    logpath => '/log',
    verbose => true,
    storage_engine => 'wiredTiger',
    auth => true,
    set_parameter => 'authenticationMechanisms=SCRAM-SHA-1',
}

but I get the error Option: setParameter is of type StringMap, but value in YAML config is not a map type so then I also tried set_parameter => 'authenticationMechanisms: SCRAM-SHA-1',

then I get Error parsing YAML config file: yaml-cpp: error at line 36, column 38: illegal map value

CostelloC avatar Apr 22 '20 08:04 CostelloC

I do not think that the error message is related to this Puppet module. It looks like a message from the mongoDB config validator.

According to the man pages of mongoDB, this parameter can only be set during the start-up:

  • https://docs.mongodb.com/manual/reference/parameters/#param.authenticationMechanisms

I think this parameter needs to be added at /etc/sysconfig/mongod, which is not managed by this module.

dhoppe avatar Apr 22 '20 10:04 dhoppe

I think it now works with this syntax-

    set_parameter => "
    authenticationMechanisms: SCRAM-SHA-1
    "

Puppet runs and mongo starts with no errors, but I need to test it out

CostelloC avatar Apr 22 '20 11:04 CostelloC

this is broken in the content_template I fixed this by copying the current template and fixing it myself

class { '::mongodb::server':
    config_template => "${module_name}/${profile_name}/mongod.conf.erb", 
}

oniGino avatar Jul 10 '20 18:07 oniGino