@@ -10,17 +10,18 @@ Ansible role which manages [MongoDB](http://www.mongodb.org/).
10
10
11
11
MongoDB support matrix:
12
12
13
- | Distribution | < MongoDB 3.2 | MongoDB 3.4 | MongoDB 3.6 | MongoDB 4.0 | MongoDB 4.2 |
14
- | -------------- | :-----------: | :----------------: | :----------------: | :----------------: | :----------------: |
15
- | Ubuntu 14.04 | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :x : |
16
- | Ubuntu 16.04 | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
17
- | Ubuntu 18.04 | :no_entry : | :x : | :x : | :white_check_mark : | :white_check_mark : |
18
- | Debian 8.x | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :x : |
19
- | Debian 9.x | :no_entry : | :x : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
20
- | RHEL 6.x | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
21
- | RHEL 7.x | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
22
- | Amazon Linux 2 | :no_entry : | :white_check_mark : | :x : | :white_check_mark : | :white_check_mark : |
23
-
13
+ | Distribution | < MongoDB 3.2 | MongoDB 3.4 | MongoDB 3.6 | MongoDB 4.0 | MongoDB 4.2 | MongoDB 4.4 |
14
+ | -------------- | :-----------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: |
15
+ | Ubuntu 14.04 | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :x : | :interrobang : |
16
+ | Ubuntu 16.04 | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :interrobang : |
17
+ | Ubuntu 18.04 | :no_entry : | :x : | :x : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
18
+ | Ubuntu 20.04 | :no_entry : | :x : | :x : | :interrobang : | :interrobang : | :white_check_mark : |
19
+ | Debian 8.x | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :x : | :white_check_mark : |
20
+ | Debian 9.x | :no_entry : | :x : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
21
+ | RHEL 6.x | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :interrobang : |
22
+ | RHEL 7.x | :no_entry : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
23
+ | RHEL 8.x | :no_entry : | :interrobang : | :interrobang : | :interrobang : | :white_check_mark : | :white_check_mark : |
24
+ | Amazon Linux 2 | :no_entry : | :white_check_mark : | :x : | :white_check_mark : | :white_check_mark : | :white_check_mark : |
24
25
- :white_check_mark : - fully tested, should works fine
25
26
- :interrobang : - maybe works, not tested
26
27
- :x : - don't have official support
@@ -32,22 +33,30 @@ MongoDB support matrix:
32
33
# You can use this variable to control installation source of MongoDB
33
34
# 'mongodb' will be installed from Debian/Ubuntu repos
34
35
# 'mongodb-org' will be installed from MongoDB official repos
35
- mongodb_package : mongodb-org
36
+ # 'percona-server-mongodb' will be installed Mongodb from percona
37
+ mongodb_package : percona-server-mongodb
36
38
37
39
# You can control installed version via this param.
38
- # Should be '3.4', '3.6', '4.0' or '4.2 '. This role doesn't support MongoDB < 3.4.
40
+ # Should be '3.4', '3.6', '4.0', '4.2' or '4.4 '. This role doesn't support MongoDB < 3.4.
39
41
# I will recommend you to use latest version of MongoDB.
40
- mongodb_version : " 4.2 "
42
+ mongodb_version : " 4.4 "
41
43
44
+ mongodb_tools : true # Install mtools, and percona-server-mongodb-tools if use Percona package
42
45
mongodb_pymongo_from_pip : true # Install latest PyMongo via PIP or package manager
43
- mongodb_pymongo_pip_version : 3.6 .1 # Choose PyMong version to install from pip. If not set use latest
46
+ mongodb_pymongo_pip_version : 3.10 .1 # Choose PyMong version to install from pip. If not set use latest
44
47
mongodb_user_update_password : " on_create" # MongoDB user password update default policy
45
48
mongodb_manage_service : true
46
49
mongodb_manage_systemd_unit : true
47
50
48
51
# Disable transparent hugepages on systemd debian based installations
52
+ # https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/
49
53
mongodb_disable_transparent_hugepages : false
50
54
55
+ # OS tuning
56
+ vm_swappiness :
57
+ vm_dirty_ratio :
58
+ vm_dirty_background_ratio :
59
+
51
60
# You can enable or disable NUMA support
52
61
mongodb_use_numa : true
53
62
@@ -68,11 +77,12 @@ mongodb_processmanagement_fork: false # Fork server process
68
77
# # security Options
69
78
# Disable or enable security. Possible values: 'disabled', 'enabled'
70
79
mongodb_security_authorization : " disabled"
71
- mongodb_security_keyfile : /etc/mongodb-keyfile # Specify path to keyfile with password for inter-process authentication
80
+ mongodb_security_keyfile : /etc/mongodb-keyfile # Specify path to keyfile with password for inter-process authentication
81
+ mongodb_active_directory_role : " " # Create role root to active directory integration
72
82
73
83
# # storage Options
74
- mongodb_storage_dbpath : /data/db # Directory for datafiles
75
- mongodb_storage_dirperdb : false # Use one directory per DB
84
+ mongodb_storage_dbpath : /data/mongodb # Directory for datafiles
85
+ mongodb_storage_dirperdb : true # Use one directory per DB
76
86
77
87
# The storage engine for the mongod database
78
88
mongodb_storage_engine : " wiredTiger"
@@ -84,15 +94,51 @@ mongodb_storage_smallfiles: false # Very useful for non-data nodes
84
94
mongodb_storage_journal_enabled : true # Enable journaling
85
95
mongodb_storage_prealloc : true # Disable data file preallocation
86
96
97
+ mongodb_wiredtiger_directory_for_indexes : true # Create directory for indexes
98
+
87
99
# WiredTiger Options
88
100
mongodb_wiredtiger_cache_size : 1 # Cache size for wiredTiger in GB
89
101
90
102
# # systemLog Options
91
103
# # The destination to which MongoDB sends all log output. Specify either 'file' or 'syslog'.
92
104
# # If you specify 'file', you must also specify mongodb_systemlog_path.
93
105
mongodb_systemlog_destination : " file"
94
- mongodb_systemlog_logappend : true # Append to logpath instead of over-writing
95
- mongodb_systemlog_path : /var/log/mongodb/{{ mongodb_daemon_name }}.log # Log file to send write to instead of stdout
106
+ mongodb_systemlog_logappend : true # Append to logpath instead of over-writing
107
+ mongodb_systemlog_logrotate : " reopen" # Logrotation behavior
108
+ mongodb_systemlog_path : /var/log/mongodb/{{ mongodb_daemon_name }}.log # Log file to send write to instead of stdout
109
+ mongodb_systemlog_verbosity : 0 # Default log message verbosity level for components
110
+
111
+ # # Example to set different verbosity for components
112
+ mongodb_systemlog_component :
113
+ accessControl :
114
+ verbosity : 5
115
+ command :
116
+ verbosity : 5
117
+ write :
118
+ verbosity : 5
119
+
120
+ # Log rotation
121
+ mongodb_logrotate : true # Rotate mongodb logs.
122
+ mongodb_logrotate_options : |
123
+ {{ mongodb_config['auditLog'].path | default('') }}
124
+ {{ mongodb_systemlog_path }} {
125
+ daily
126
+ rotate 7
127
+ maxsize 1G
128
+ missingok
129
+ compress
130
+ delaycompress
131
+ notifempty
132
+ create 640 {{ mongodb_user }} {{ mongodb_user }}
133
+ sharedscripts
134
+ postrotate
135
+ /bin/kill -SIGUSR1 `cat /run/mongodb/mongod.pid 2>/dev/null` >/dev/null 2>&1
136
+ endscript
137
+ }
138
+
139
+ # # operationProfiling Options
140
+ mongodb_operation_profiling_slow_op_threshold_ms : 1000
141
+ mongodb_operation_profiling_mode : " off"
96
142
97
143
# # replication Options
98
144
mongodb_replication_replset : # Enable replication <setname>[/<optionalseedhostlist>]
@@ -120,45 +166,48 @@ mongodb_mms_group_id: ""
120
166
mongodb_mms_api_key : " "
121
167
mongodb_mms_base_url : https://mms.mongodb.com
122
168
123
- # Log rotation
124
- mongodb_logrotate : true # Rotate mongodb logs.
125
- mongodb_logrotate_options :
126
- - compress
127
- - copytruncate
128
- - daily
129
- - dateext
130
- - rotate 7
131
- - size 10M
132
-
133
- # password for inter-process authentication
134
- # please regenerate this file on production environment with command 'openssl rand -base64 741'
135
- mongodb_keyfile_content : |
136
- 8pYcxvCqoe89kcp33KuTtKVf5MoHGEFjTnudrq5BosvWRoIxLowmdjrmUpVfAivh
137
- CHjqM6w0zVBytAxH1lW+7teMYe6eDn2S/O/1YlRRiW57bWU3zjliW3VdguJar5i9
138
- Z+1a8lI+0S9pWynbv9+Ao0aXFjSJYVxAm/w7DJbVRGcPhsPmExiSBDw8szfQ8PAU
139
- 2hwRl7nqPZZMMR+uQThg/zV9rOzHJmkqZtsO4UJSilG9euLCYrzW2hdoPuCrEDhu
140
- Vsi5+nwAgYR9dP2oWkmGN1dwRe0ixSIM2UzFgpaXZaMOG6VztmFrlVXh8oFDRGM0
141
- cGrFHcnGF7oUGfWnI2Cekngk64dHA2qD7WxXPbQ/svn9EfTY5aPw5lXzKA87Ds8p
142
- KHVFUYvmA6wVsxb/riGLwc+XZlb6M9gqHn1XSpsnYRjF6UzfRcRR2WyCxLZELaqu
143
- iKxLKB5FYqMBH7Sqg3qBCtE53vZ7T1nefq5RFzmykviYP63Uhu/A2EQatrMnaFPl
144
- TTG5CaPjob45CBSyMrheYRWKqxdWN93BTgiTW7p0U6RB0/OCUbsVX6IG3I9N8Uqt
145
- l8Kc+7aOmtUqFkwo8w30prIOjStMrokxNsuK9KTUiPu2cj7gwYQ574vV3hQvQPAr
146
- hhb9ohKr0zoPQt31iTj0FDkJzPepeuzqeq8F51HB56RZKpXdRTfY8G6OaOT68cV5
147
- vP1O6T/okFKrl41FQ3CyYN5eRHyRTK99zTytrjoP2EbtIZ18z+bg/angRHYNzbgk
148
- lc3jpiGzs1ZWHD0nxOmHCMhU4usEcFbV6FlOxzlwrsEhHkeiununlCsNHatiDgzp
149
- ZWLnP/mXKV992/Jhu0Z577DHlh+3JIYx0PceB9yzACJ8MNARHF7QpBkhtuGMGZpF
150
- T+c73exupZFxItXs1Bnhe3djgE3MKKyYvxNUIbcTJoe7nhVMrwO/7lBSpVLvC4p3
151
- wR700U0LDaGGQpslGtiE56SemgoP
169
+ # Password for inter-process authentication
170
+ # If not defined, it will be generated at runtime with the command 'openssl rand -base64 756'
171
+ # Be careful if you perform the function to configure different servers in different executions, different keys will be generated
172
+ # therefore, the service will not be able to authenticate, in which case you need to specify the key to have exactly the same
173
+ # If mongodb_keyfile_force_renew is true and the keyfile alredy exist in the host, the keyfile will be replaced with mongodb_keyfile_content when defined or with a new runtime generate key
174
+ mongodb_keyfile_force_renew : false
175
+ mongodb_keyfile_content :
152
176
153
177
# names and passwords for administrative users
154
- mongodb_user_admin_name : siteUserAdmin
155
- mongodb_user_admin_password : passw0rd
156
-
157
- mongodb_root_admin_name : siteRootAdmin
158
- mongodb_root_admin_password : passw0rd
178
+ mongodb_root_user_name : admin
179
+ mongodb_root_user_password : passw0rd
180
+
181
+ mongodb_backup_user_name : " "
182
+ mongodb_backup_user_password : " "
183
+
184
+ # Additional administrator user, if not setted, will not be created
185
+ mongodb_admin_user_name :
186
+ mongodb_admin_user_password :
187
+
188
+ # MongoDB Backup
189
+ mongodb_backup : false
190
+ mongodb_backup_engine : pbm # pbm | mongodump
191
+ mongodb_backup_state : present
192
+ mongodb_backup_script_path : " /etc/mongodb-backup.sh"
193
+ mongodb_backup_log_path : " {{ mongodb_systemlog_path|dirname }}/backup_mongod.log"
194
+ mongodb_backup_path : " {{ mongodb_storage_dbpath }}/backup" # Local path to mongodump, or PBM path to backups # Do not use "/" in the end of directories
195
+ mongodb_backup_path_hot_storage : " {{ mongodb_backup_path }}/storage" # Path to storage mongodump backup, or path to PBM Hot Backups when use PBM # Do not use "/" in the end of directories
196
+ mongodb_backup_parameters : " --mongodb-uri \" mongodb://{{ mongodb_backup_user_name }}:{{ mongodb_backup_user_password }}@{{ inventory_hostname }}:{{ mongodb_net_port }}/admin?replicaSet={{ mongodb_replication_replset }}\" " # Mongodump: "--gzip --forceTableScan"
197
+ mongodb_backup_cron_time :
198
+ hour : 3
199
+ minute : 0
200
+ mongodb_backup_logrotate : |
201
+ {{ mongodb_backup_log_path }} {
202
+ size 100k
203
+ dateext
204
+ dateformat -%Y%m%d
205
+ rotate 7
206
+ create 644
207
+ }
159
208
160
- mongodb_root_backup_name : backupuser
161
- mongodb_root_backup_password : passw0rd
209
+ # Enable PBM Point-in-Time Recovery
210
+ mongodb_backup_pbm_pitr_enable : true
162
211
` ` `
163
212
164
213
#### Usage
@@ -191,9 +240,8 @@ mongodb_oplog_users:
191
240
Required vars to change on production :
192
241
193
242
` ` ` yaml
194
- mongodb_user_admin_password
195
- mongodb_root_admin_password
196
- mongodb_root_backup_password
243
+ mongodb_root_user_password
244
+ mongodb_backup_user_password
197
245
198
246
# if you use replication and authorization
199
247
mongodb_security_keyfile
0 commit comments