salt.states.mongodb_user

Management of Mongodb users

Note

This module requires PyMongo to be installed.

salt.states.mongodb_user.absent(name, user=None, password=None, host=None, port=None, database='admin', authdb=None)

Deprecated since version Fluorine: Use mongodb.user_absent instead

Ensure that the named user is absent

name
The name of the user to remove
user
MongoDB user with sufficient privilege to create the user
password
Password for the admin user specified by the user parameter
host
The hostname/IP address of the MongoDB server
port
The port on which MongoDB is listening
database
The database from which to remove the user specified by the name parameter
authdb
The database in which to authenticate
salt.states.mongodb_user.present(name, passwd, database='admin', user=None, password=None, host='localhost', port=27017, authdb=None, roles=None)

Deprecated since version Fluorine: Use mongodb.user_present instead

Ensure that the user is present with the specified properties

name
The name of the user to manage
passwd
The password of the user to manage
user
MongoDB user with sufficient privilege to create the user
password
Password for the admin user specified with the user parameter
host
The hostname/IP address of the MongoDB server
port
The port on which MongoDB is listening
database

The database in which to create the user

Note

If the database doesn't exist, it will be created.

authdb
The database in which to authenticate
roles
The roles assigned to user specified with the name parameter

Example:

mongouser-myapp:
  mongodb_user.present:
  - name: myapp
  - passwd: password-of-myapp
  - database: admin
  # Connect as admin:sekrit
  - user: admin
  - password: sekrit
  - roles:
      - readWrite
      - userAdmin
      - dbOwner