|
|
@ -350,7 +350,7 @@ def main():
|
|
|
|
module.fail_json(msg='The localhost login exception only allows the first admin account to be created')
|
|
|
|
module.fail_json(msg='The localhost login exception only allows the first admin account to be created')
|
|
|
|
#else: this has to be the first admin user added
|
|
|
|
#else: this has to be the first admin user added
|
|
|
|
|
|
|
|
|
|
|
|
except ConnectionFailure, e:
|
|
|
|
except Exception, e:
|
|
|
|
module.fail_json(msg='unable to connect to database: %s' % str(e))
|
|
|
|
module.fail_json(msg='unable to connect to database: %s' % str(e))
|
|
|
|
|
|
|
|
|
|
|
|
check_compatibility(module, client)
|
|
|
|
check_compatibility(module, client)
|
|
|
@ -370,7 +370,7 @@ def main():
|
|
|
|
module.exit_json(changed=True, user=user)
|
|
|
|
module.exit_json(changed=True, user=user)
|
|
|
|
|
|
|
|
|
|
|
|
user_add(module, client, db_name, user, password, roles)
|
|
|
|
user_add(module, client, db_name, user, password, roles)
|
|
|
|
except OperationFailure, e:
|
|
|
|
except Exception, e:
|
|
|
|
module.fail_json(msg='Unable to add or update user: %s' % str(e))
|
|
|
|
module.fail_json(msg='Unable to add or update user: %s' % str(e))
|
|
|
|
|
|
|
|
|
|
|
|
# Here we can check password change if mongo provide a query for that : https://jira.mongodb.org/browse/SERVER-22848
|
|
|
|
# Here we can check password change if mongo provide a query for that : https://jira.mongodb.org/browse/SERVER-22848
|
|
|
@ -381,7 +381,7 @@ def main():
|
|
|
|
elif state == 'absent':
|
|
|
|
elif state == 'absent':
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
user_remove(module, client, db_name, user)
|
|
|
|
user_remove(module, client, db_name, user)
|
|
|
|
except OperationFailure, e:
|
|
|
|
except Exception, e:
|
|
|
|
module.fail_json(msg='Unable to remove user: %s' % str(e))
|
|
|
|
module.fail_json(msg='Unable to remove user: %s' % str(e))
|
|
|
|
|
|
|
|
|
|
|
|
module.exit_json(changed=True, user=user)
|
|
|
|
module.exit_json(changed=True, user=user)
|
|
|
|