Merge pull request #128 from litewhatever/master

Oplog user creation
This commit is contained in:
Sergei Antipov 2019-03-09 22:56:19 -05:00 committed by GitHub
commit 6745bcc28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View File

@ -156,6 +156,14 @@ mongodb_users:
database: app_development database: app_development
} }
``` ```
Example vars for oplog user:
```yaml
mongodb_oplog_users:
- {
user: oplog,
password: passw0rd
}
```
Required vars to change on production: Required vars to change on production:
```yaml ```yaml
mongodb_user_admin_password mongodb_user_admin_password

View File

@ -88,6 +88,28 @@
no_log: true no_log: true
tags: [mongodb] tags: [mongodb]
- name: create oplog user with replicaset
mongodb_user_fixed:
database: admin
user: "{{ item.user }}"
password: "{{ item.password }}"
update_password: "{{ mongodb_user_update_password }}"
roles:
- db: local
role: read
login_user: "{{ mongodb_user_admin_name }}"
login_password: "{{ mongodb_user_admin_password }}"
login_port: "{{ mongodb_login_port|default(27017) }}"
login_host: "{{ mongodb_login_host|default('localhost') }}"
with_items:
- "{{ mongodb_oplog_users | default([]) }}"
when: ( mongodb_replication_replset
and mongodb_replication_replset != ''
and mongodb_security_authorization == 'enabled'
and mongodb_master is defined and mongodb_master )
no_log: false
tags: [mongodb]
- name: Include MMS Agent configuration - name: Include MMS Agent configuration
include: mms-agent.yml include: mms-agent.yml
when: mongodb_mms_api_key != "" when: mongodb_mms_api_key != ""