title: MongoDB create user kills restart
body: <p>We use Ansible for installing MongoDB, but we have a problem with installing MongoDB (2.2 - an old version, but currently standard in our platform) on CentOS 6.x 64bit.</p>
  
  <p>This playbook will download the <code>mongodb-linux-x86_64-2.2.0.tgz</code> file and extract it into <code>/opt</code>. We add <code>/etc/mongodb.conf</code> and install the init script. This is all fine and you can (re)start the mongo service on provisioned machines.</p>
  
  <p>But when we create an user in the 'admin' database:</p>
  
  <pre><code>echo 'db.addUser("mongoadmin", "password");' | mongo admin
  </code></pre>
  
  <p>it will succeed, but when we restart MongoDB, it will fail and keep failing. I "played" with the <code>auth = true</code> option, but it keeps failing. Not only for the 'admin' database, but also for the 'local' or other newly created databases.</p>
  
  <p>It all worked until a few weeks ago and I don't know why. We have it on multiple machines, so it isn't related to a single machine.</p>
  
  <p>What could be the issue?</p>