UnderGreen / ansible-role-mongodb

Ansible role to configure MongoDB
GNU General Public License v2.0
343 stars 294 forks source link

failed: "msg": "Unable to initiate replica set: already initialized"} #179

Open EvgeniiProkofevItomych opened 5 years ago

EvgeniiProkofevItomych commented 5 years ago

Hi. I'am trying to contribute this role. Faced this error many times. This one after updating mongo from 4.0 to 4.2


TASK [undergreen.mongodb.4.2 : Replication configuration | 2nd Pt] *********************************************************
skipping: [development-mongodb-2] => (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'development-mongodb-1.xxx.io'}) 
skipping: [development-mongodb-2] => (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'development-mongodb-2.xxx.io'}) 
skipping: [development-mongodb-2] => (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'development-mongodb-3.xxx.io'}) 
skipping: [development-mongodb-3] => (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'development-mongodb-1.xxx.io'}) 
skipping: [development-mongodb-3] => (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'development-mongodb-2.xxx.io'}) 
skipping: [development-mongodb-3] => (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'development-mongodb-3.xxx.io'}) 
failed: [development-mongodb-1] (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'development-mongodb-1.xxx.io'}) => {"ansible_loop_var": "item", "changed": false, "item": {"host_name": "development-mongodb-1.xxx.io", "host_port": 27017, "host_type": "replica"}, "msg": "Unable to initiate replica set: already initialized"}
EvgeniiProkofevItomych commented 5 years ago

There should be a workaround to separate nodes in replica set to standalone instances. I think that should help with workaround in such cases.