Skip to content

Commit f172755

Browse files
committed
add support for extending config
1 parent 4531d91 commit f172755

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,6 @@ mongodb_root_backup_password: passw0rd
124124

125125
# setParameter config
126126
mongodb_set_parameters:
127+
128+
# custom config options
129+
mongodb_config:

templates/mongod.conf.j2

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ net:
1414
mode: {{ mongodb_net_ssl_mode }}
1515
PEMKeyFile: {{ mongodb_net_ssl_pemfile }}
1616
{% endif %}
17+
{% if mongodb_config['net'] is defined and mongodb_config['net'] is iterable -%}
18+
{% for item in mongodb_config['net'] -%}
19+
{{ item }}
20+
{% endfor -%}
21+
{% endif -%}
1722

1823
processManagement:
1924
fork: {{ mongodb_processmanagement_fork | to_nice_json}}
2025
{% if mongodb_pidfile_path is defined and mongodb_pidfile_path != '' -%}
2126
pidFilePath: {{ mongodb_pidfile_path }}
2227
{% endif %}
28+
{% if mongodb_config['processManagement'] is defined and mongodb_config['processManagement'] is iterable -%}
29+
{% for item in mongodb_config['processManagement'] -%}
30+
{{ item }}
31+
{% endfor -%}
32+
{% endif -%}
2333

2434
{% if mongodb_replication_replset -%}
2535
replication:
@@ -28,6 +38,11 @@ replication:
2838
{% if mongodb_storage_engine == 'mmapv1' -%}
2939
secondaryIndexPrefetch: {{ mongodb_replication_replindexprefetch }}
3040
{% endif %}
41+
{% if mongodb_config['replication'] is defined and mongodb_config['replication'] is iterable -%}
42+
{% for item in mongodb_config['replication'] -%}
43+
{{ item }}
44+
{% endfor -%}
45+
{% endif -%}
3146
{% endif %}
3247

3348
security:
@@ -36,6 +51,11 @@ security:
3651
keyFile: {{ mongodb_security_keyfile }}
3752
{% endif -%}
3853
javascriptEnabled: {{ mongodb_security_javascript_enabled | to_nice_json }}
54+
{% if mongodb_config['security'] is defined and mongodb_config['security'] is iterable -%}
55+
{% for item in mongodb_config['security'] -%}
56+
{{ item }}
57+
{% endfor -%}
58+
{% endif -%}
3959

4060
storage:
4161
dbPath: {{ mongodb_storage_dbpath }}
@@ -58,6 +78,11 @@ storage:
5878
{% endif -%}
5979
directoryForIndexes: {{ mongodb_wiredtiger_directory_for_indexes | to_nice_json }}
6080
{% endif %}
81+
{% if mongodb_config['storage'] is defined and mongodb_config['storage'] is iterable -%}
82+
{% for item in mongodb_config['storage'] -%}
83+
{{ item }}
84+
{% endfor -%}
85+
{% endif -%}
6186

6287
systemLog:
6388
destination: {{ mongodb_systemlog_destination }}
@@ -66,16 +91,31 @@ systemLog:
6691
logRotate: {{ mongodb_systemlog_logrotate }}
6792
path: {{ mongodb_systemlog_path }}
6893
{% endif %}
94+
{% if mongodb_config['systemLog'] is defined and mongodb_config['systemLog'] is iterable -%}
95+
{% for item in mongodb_config['systemLog'] -%}
96+
{{ item }}
97+
{% endfor -%}
98+
{% endif -%}
6999

70100
operationProfiling:
71101
slowOpThresholdMs: {{ mongodb_operation_profiling_slow_op_threshold_ms }}
72102
mode: {{ mongodb_operation_profiling_mode }}
103+
{% if mongodb_config['operationProfiling'] is defined and mongodb_config['operationProfiling'] is iterable -%}
104+
{% for item in mongodb_config['operationProfiling'] -%}
105+
{{ item }}
106+
{% endfor -%}
107+
{% endif -%}
73108

74109
{% if mongodb_major_version is version("4.0", ">=") -%}
75110
cloud:
76111
monitoring:
77112
free:
78113
state: {{ mongodb_cloud_monitoring_free_state }}
114+
{% if mongodb_config['cloud'] is defined and mongodb_config['cloud'] is iterable -%}
115+
{% for item in mongodb_config['cloud'] -%}
116+
{{ item }}
117+
{% endfor -%}
118+
{% endif -%}
79119
{% endif -%}
80120

81121
{% if mongodb_set_parameters -%}

0 commit comments

Comments
 (0)