Skip to content

Commit dd3cc14

Browse files
Modifying mongod conf template.
The new template will test if the systemLog option is file or syslog to add the correct file path options.
1 parent 293d820 commit dd3cc14

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

tasks/configure.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,17 @@
2323

2424
- name: Create log dir if missing
2525
file: state=directory recurse=yes dest={{ mongodb_systemlog_path|dirname }} owner={{ mongodb_user }} group={{mongodb_user}} mode=0755
26+
when: mongodb_systemlog_destination == "file"
2627

2728
- name: Check than logfile exists
2829
stat: path={{ mongodb_systemlog_path }}
2930
register: logfile_stat
31+
when: mongodb_systemlog_destination == "file"
3032

3133
- name: Create log if missing
3234
file: state=touch dest={{ mongodb_systemlog_path }} owner={{ mongodb_user }} group={{mongodb_user}} mode=0755
3335
when: logfile_stat is defined and not logfile_stat.stat.exists
36+
when: mongodb_systemlog_destination == "file"
3437

3538
- name: Ensure dbpath directory
3639
file:

templates/mongod.conf.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ storage:
5353

5454
systemLog:
5555
destination: {{ mongodb_systemlog_destination }}
56+
{% if mongodb_systemlog_destination == 'file' -%}
5657
logAppend: {{ mongodb_systemlog_logappend | to_nice_json }}
5758
path: {{ mongodb_systemlog_path }}
59+
{% endif %}
5860

5961
{% if mongodb_set_parameters -%}
6062
setParameter:

templates/mongod_init.conf.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ storage:
4141

4242
systemLog:
4343
destination: {{ mongodb_systemlog_destination }}
44+
{% if mongodb_systemlog_destination == 'file' -%}
4445
logAppend: {{ mongodb_systemlog_logappend | to_nice_json }}
4546
path: {{ mongodb_systemlog_path }}
47+
{% endif -%}

0 commit comments

Comments
 (0)