# Unable to login with credentials used to create mongo user

**URL:** <https://forum.ansible.com/t/unable-to-login-with-credentials-used-to-create-mongo-user/15090>\
**Category:** Ansible Project\
**Created:** [April 25, 2014, 6:27am UTC](https://forum.ansible.com/t/unable-to-login-with-credentials-used-to-create-mongo-user/15090 "2014-04-25T06:27:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hugo\_lassiege](https://avatars.discourse-cdn.com/v4/letter/h/848f3c/32.png) [@hugo\_lassiege](https://forum.ansible.com/u/hugo_lassiege)\
**Post date:** [April 25, 2014, 6:27am UTC](https://forum.ansible.com/t/unable-to-login-with-credentials-used-to-create-mongo-user/15090/1 "2014-04-25T06:27:28Z")

</div>

Hi,

I’ve open an issue on Github ([https://github.com/ansible/ansible/issues/7157](https://github.com/ansible/ansible/issues/7157)) about mongo\_user module.

I’m trying to use mongo\_user to create some users. However, I’m unable to login with the credentials specified.

I use the following commands :

- name: add Mongo admin  
mongodb\_user: database=admin name=bigadmin password=BigBosS roles=‘root’ state=present  
sudo: true

and then, if I try to connect, it fails :  
mongo admin -u bigadmin -p BigBosS  
=\> auth failed

But if I add this user manually on mongo it works  
db.addUser({user: “superadmin”, pwd: “BigBosS”, roles: [{role:“root”, db:“admin”}]})

mongo admin -u superadmin-p BigBosS  
=\> auth successfull

The weird thing is that the password is different in the admin db.system.users collection :

> db.system.users.find()  
> { “\_id” : “admin.bigadmin”, “user” : “bigadmin”, “db” : “admin”, “credentials” : { “MONGODB-CR” : “8757ec7d8b6d462f69e10c51d36ff9c1” }, “roles” : [{ “role” : “root”, “db” : “admin” }] }  
> { “\_id” : “admin.superadmin”, “user” : “superadmin”, “db” : “admin”, “credentials” : { “MONGODB-CR” : “96dfab41377d3965ce104f7b1f3d8044” }, “roles” : [{ “role” : “root”, “db” : “admin” }] }  
> I think the password shoud be identical.

Any idea about that ?
