Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

rolatsch
Copy link

SUMMARY

To allow the initialization of configserver replicasets for sharded clusters i've added the configsrv parameter to the replicaset_add function.

Relevant docs:
https://www.mongodb.com/docs/manual/tutorial/deploy-shard-cluster/#initiate-the-replica-set
https://www.mongodb.com/docs/manual/reference/replica-configuration/#mongodb-rsconf-rsconf.configsvr

COMPONENT NAME

mongodb_replicaset module

@rhysmeister
Copy link
Collaborator

Hello @rolatsch,

If memory serves correctly somehow mentioned this a whle back... the thing is the module already works for config server replicasets. See here...

https://github.com/ansible-collections/community.mongodb/blob/master/tests/integration/targets/mongodb_shard/tasks/main.yml

What's the consequence of not doing this?

Rhys

@rolatsch
Copy link
Author

rolatsch commented Sep 1, 2025

Hello @rhysmeister,
thank you for looking into this.
Actually i'm not sure about this. The mongodb docs say that you should add configsvr: true to the document you pass to rs.initiate.
Only piece of intel i found on this, is this google group from 2016.

Roland

@rolatsch
Copy link
Author

rolatsch commented Sep 8, 2025

Did some testing on this an could not spot a difference between ReplicaSets that were initialized with this parameter and ones that were initialized without 🤷‍♂️

@rhysmeister
Copy link
Collaborator

I would guess that it automatically adds this flag if the host was started with the --configsrv flag. I'm not really sure why it's there tbh.

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

Successfully merging this pull request may close these issues.

2 participants