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

Changing any MongoDB configuration option results in replicaSet reconf #171

Open
TomaszUrugOlszewski opened this issue Aug 8, 2019 · 1 comment

Comments

@TomaszUrugOlszewski
Copy link

Hi,

This issue is very easy to recreate. Setup MongoDB with authentication and replication. Change any configuration option, e.g. preferSSL to allowSSL. Something that should result in simple change of value in configuration file and (maybe) MongoDB restart.

What really happens is replay of full procedure to set authentication and replication. I think it's urgent and critical issue, because it looks like ansible is trying to destroy correctly running setup. And it will happen if someone in panic hit control-c here.

In my humble opinion, ansible shouldn't touch replication after it's already set. E.g. another task that checks replication status (check output of rs.conf).

    TASK [undergreen.mongodb : Configure mongodb] **********************************
    changed: [test-mongodb-a1-debian-stretch]
    changed: [test-mongodb-a2-debian-stretch]
    
    RUNNING HANDLER [undergreen.mongodb : mongodb restart] *************************
    changed: [test-mongodb-a1-debian-stretch]
    changed: [test-mongodb-a2-debian-stretch]
    
    RUNNING HANDLER [undergreen.mongodb : service started] *************************
    ok: [test-mongodb-a2-debian-stretch]
    ok: [test-mongodb-a1-debian-stretch]
    
    RUNNING HANDLER [undergreen.mongodb : wait when mongodb is started] ************
    ok: [test-mongodb-a2-debian-stretch] => (item=127.0.0.1)
    ok: [test-mongodb-a1-debian-stretch] => (item=127.0.0.1)
    ok: [test-mongodb-a2-debian-stretch] => (item=172.18.0.8)
    ok: [test-mongodb-a1-debian-stretch] => (item=172.18.0.7)
    
    TASK [undergreen.mongodb : Replication configuration | 1st Pt.] ****************
    skipping: [test-mongodb-a2-debian-stretch] => (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'test-mongodb-a2-debian-stretch'}) 
    failed: [test-mongodb-a1-debian-stretch] (item={u'host_port': 27017, u'host_type': u'replica', u'host_name': u'test-mongodb-a1-debian-stretch'}) => changed=false 
      item:
        host_name: test-mongodb-a1-debian-stretch
        host_port: 27017
        host_type: replica
      msg: 'Unable to initiate replica set: already initialized'
    ...ignoring
    
    TASK [undergreen.mongodb : Use different mongod.conf for auth initialization] ***
    skipping: [test-mongodb-a2-debian-stretch]
    changed: [test-mongodb-a1-debian-stretch]
 [WARNING]: flush_handlers task does not support when conditional

    
    RUNNING HANDLER [undergreen.mongodb : mongodb restart] *************************
    changed: [test-mongodb-a1-debian-stretch]
    
    RUNNING HANDLER [undergreen.mongodb : wait when mongodb is started on localhost] ***
@TomaszUrugOlszewski TomaszUrugOlszewski changed the title Changing any MongoDB configuration option results in auth reconf Changing any MongoDB configuration option results in replicaSet reconf Aug 8, 2019
@TomaszUrugOlszewski
Copy link
Author

Problem exists, because MongoDB needs few seconds to 'catch up' after restart. In theory there is handler "wait when mongodb is started", but it's only checking if MongoDB is up, and that's not enough.

Simply adding "delay: 10" to task "wait when mongodb is started" helps in short term, but of course it's not correct solution.

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

1 participant