ansible-role-mongodb
ansible-role-mongodb copied to clipboard
Is it possible to create uploguser with mongodb_user
Hello
When looking into library/mongodb_user_fixed.py I found the following:
- mongodb_user:
login_user: root
login_password: root_password
database: admin
user: oplog_reader
password: oplog_reader_password
state: present
replica_set: belcher
roles:
- db: local
role: read
But when trying to use it as follows:
mongodb_users:
- {
name: oploguser,
password: passw0rd,
database: admin,
roles:
- db: local
role: read
}
Ansible gives YAML syntax error.
PLAY [apply common configuration to all nodes] *********************************************************************************************************************************************************************************************************************************
ERROR! Syntax Error while loading YAML.
did not find expected node content
The error appears to have been in '/etc/ansible/group_vars/mongodb': line 40, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
roles:
- db: local
^ here
Please advise if it is currently possible to create a oplog user in admin database with read access into local database.
You have a mix of syntax here:
it should be
roles: [{db: 'local', role: 'read'}]