Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x version. Initialization of replset and user creation problem. #583

Closed
bimcas opened this issue Apr 23, 2020 · 7 comments
Closed

4.x version. Initialization of replset and user creation problem. #583

bimcas opened this issue Apr 23, 2020 · 7 comments

Comments

@bimcas
Copy link

bimcas commented Apr 23, 2020

  • Puppet: 5.5.19
  • puppet-mongodb module version: v3.1.0
  • MongoDB: 4.0.x and 4.2.x

I'm using puppet-mongodb module directly from https://github.com/voxpupuli/puppet-mongodb
:git => 'https://github.com/voxpupuli/puppet-mongodb.git'
:tag => 'v3.1.0'

What are you seeing

When I use MongoDB 3.x (3.4, 3.6) everything is OK. During installation of node I get just one warning:

Warning: Host is available, but you are unauthorized because of authentication is enabled: true

but everything is OK. Puppet successfully completes initialization of replset (primary) and all necessary users have been created:

[[email protected] ~]# mongo
MongoDB shell version v3.6.17
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("1d48b06f-1b16-4235-92a9-4c36ff9c1844") }
MongoDB server version: 3.6.17
mon-rep:PRIMARY>

Great!

So, when I'm trying to do the same with MongoDB 4.x versions (my hiera configuration of puppet is totally the same in all cases) the result is negative:

MongoDB shell version v4.2.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("0b21d660-4eca-4e13-a9ea-79c9ff33476d") }
MongoDB server version: 4.2.6
**Error: Authentication failed.**
>

So, initialization of replset (primary), authentication, and creation of users failed. So, MongoDB isn't prepared to use.

What behaviour did you expect instead

It would be great to get the same result with 4.x in preparation of MongoDB as I have with 3.x versions.

Thanks.

@bimcas
Copy link
Author

bimcas commented Apr 29, 2020

Does the anyone use this module with MongoDB 4.2 version? Is it everything is OK?

@epopoee
Copy link

epopoee commented Jul 13, 2020

Using this mod via Satellite 6.7 and MongoDB 4.2
Initialize a replset with auth enabled fails.

@DENISKI
Copy link

DENISKI commented Jul 24, 2020

Can someone fix the issue. It's impossible to use the module with mongo 4.x enabling auth and replica set.

@dhs-rec
Copy link
Contributor

dhs-rec commented Sep 8, 2020

Don't even need a replset. Can't setup admin user, database and database user here with auth enabled.

@ghost
Copy link

ghost commented Sep 23, 2020

We have the same issue, but we found an kind-of acceptable workaround in comparison to what would have to change in the module.

Within a wrapper module we check it like so:

  if $facts['mongodb_is_master'] == 'not_installed' {
    $cluster_args = {}
  } else {
    create_resources('mongodb::db', $databases)

    $cluster_args = {
     # your actual config goes here
    }
  }

  class { '::mongodb::server':
    # all your config
    *  => $cluster_args,
  }

@igalic
Copy link

igalic commented Sep 25, 2020

i don't understand what the values of $facts['mongodb_is_master'] can be

given the name, you'd think the value should be Boolean

@tsgoff
Copy link

tsgoff commented Nov 27, 2020

Another dirty workaround during the first deployment run with 4.2:

  • fact the primary in the mongo host array and ensure that there is no lock file
  • stop the mongod
  • start the mongod without authentication in a subshell
  • create the admin user with db.createUser()
  • kill the mongod process
  • create lock file
  • trigger new puppet apply

@bimcas bimcas closed this as completed Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants