Skip to content

Commit 86d4cb2

Browse files
author
Sergei Antipov
committed
Merged backup user creating
2 parents 6341395 + 5eed19b commit 86d4cb2

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ mongodb_mms_group_id: ""
9191
mongodb_mms_api_key: ""
9292
mongodb_mms_base_url: https://mms.mongodb.com
9393

94+
# Log rotation
95+
mongodb_logrotate: true # Rotate mongodb logs.
96+
mongodb_logrotate_options:
97+
- compress
98+
- copytruncate
99+
- daily
100+
- dateext
101+
- rotate 7
102+
- size 10M
103+
94104
# password for inter-process authentication
95105
# please regenerate this file on production environment with command 'openssl rand -base64 741'
96106
mongodb_keyfile_content: |
@@ -138,6 +148,7 @@ Required vars to change on production:
138148
```yaml
139149
mongodb_user_admin_password
140150
mongodb_root_admin_password
151+
mongodb_root_backup_name
141152
142153
# if you use replication and authorization
143154
mongodb_security_keyfile

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,6 @@ mongodb_user_admin_password: passw0rd
8787

8888
mongodb_root_admin_name: siteRootAdmin
8989
mongodb_root_admin_password: passw0rd
90+
91+
mongodb_root_backup_name: "backupuser"
92+
mongodb_root_backup_password: "passw0rd"

tasks/auth_initialization.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@
4949
roles: "root"
5050
}
5151

52+
- name: create backup user "backupuser"
53+
mongodb_user:
54+
database: admin
55+
name: "{{ item.name }}"
56+
password: "{{ item.password }}"
57+
update_password: "{{ mongodb_user_update_password }}"
58+
roles: "{{ item.roles }}"
59+
login_port: "{{ mongodb_net_port }}"
60+
with_items:
61+
- {
62+
name: "{{ mongodb_root_backup_name }}",
63+
password: "{{ mongodb_root_backup_password }}",
64+
roles: "backup,clusterMonitor"
65+
}
66+
5267
- name: Move back mongod.conf
5368
template: src=mongod.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0644
5469

0 commit comments

Comments
 (0)