forked from ISTI-ansible-roles/ansible-roles
library/roles/mongodb-org-3, library/roles/mongodb-org-3.2: Fix the log opening behaviour when there is no external log rotate configuration.
This commit is contained in:
parent
0d3b6b4cbe
commit
3dbc9326c7
|
@ -16,7 +16,6 @@ mongodb_logdir: /var/log/mongodb
|
|||
mongodb_log_file: mongod.log
|
||||
mongodb_logpath: '{{ mongodb_logdir }}/{{ mongodb_log_file }}'
|
||||
mongodb_dbpath: /var/lib/mongodb
|
||||
mongodb_log_retain_days: 7
|
||||
mongodb_directoryperdb: 'false'
|
||||
mongodb_conf_file: /etc/mongod.conf
|
||||
mongodb_daemon: /usr/bin/mongod
|
||||
|
@ -27,11 +26,14 @@ mongodb_allowed_hosts:
|
|||
|
||||
mongodb_storage_engine: wiredTiger
|
||||
|
||||
# Do not change the default. We do not manage a logrotate configuration yet
|
||||
mongodb_systemlog_external_logrotate: False
|
||||
mongodb_systemlog_destination: file
|
||||
mongodb_log_retain_days: 7
|
||||
# Not used anymore inside the template. Now we use different values based on mongodb_systemlog_external_logrotate
|
||||
mongodb_systemlog_logappend: 'true'
|
||||
mongodb_systemlog_logrotate: reopen
|
||||
|
||||
|
||||
mongodb_cluster_enabled: False
|
||||
mongodb_replicaset: storagedev
|
||||
mongodb_replica_keyfile: '{{ mongodb_dbpath }}/replica_keyfile'
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
|
||||
- name: Install the cron job that manages log files rotation
|
||||
template: src=mongo_log_rotate.sh.j2 dest=/etc/cron.daily/mongo_log_rotate owner=root group=root mode=0555
|
||||
when: not mongodb_systemlog_external_logrotate
|
||||
tags: [ 'mongodb', 'mongo_logrotate' ]
|
||||
|
||||
- name: Ensure mongodb is started and enabled
|
||||
|
|
|
@ -16,10 +16,14 @@ storage:
|
|||
# where to write logging data.
|
||||
systemLog:
|
||||
destination: {{ mongodb_systemlog_destination }}
|
||||
logAppend: {{ mongodb_systemlog_logappend }}
|
||||
path: {{ mongodb_logpath }}
|
||||
logRotate: {{ mongodb_systemlog_logrotate }}
|
||||
|
||||
{% if mongodb_systemlog_external_logrotate %}
|
||||
logRotate: rename
|
||||
logAppend: false
|
||||
{% else %}
|
||||
logRotate: reopen
|
||||
logAppend: true
|
||||
{% endif %}
|
||||
# network interfaces
|
||||
net:
|
||||
port: {{ mongodb_tcp_port }}
|
||||
|
|
|
@ -14,7 +14,6 @@ mongodb_logdir: /var/log/mongodb
|
|||
mongodb_log_file: mongod.log
|
||||
mongodb_logpath: '{{ mongodb_logdir }}/{{ mongodb_log_file }}'
|
||||
mongodb_dbpath: /var/lib/mongodb
|
||||
mongodb_log_retain_days: 7
|
||||
mongodb_directoryperdb: 'false'
|
||||
mongodb_conf_file: /etc/mongod.conf
|
||||
mongodb_daemon: /usr/bin/mongod
|
||||
|
@ -25,12 +24,14 @@ mongodb_allowed_hosts:
|
|||
|
||||
mongodb_storage_engine: wiredTiger
|
||||
|
||||
# Do not change the default. We do not manage a logrotate configuration yet
|
||||
mongodb_systemlog_external_logrotate: False
|
||||
mongodb_systemlog_destination: file
|
||||
mongodb_log_retain_days: 7
|
||||
# Not used anymore inside the template. Now we use different values based on mongodb_systemlog_external_logrotate
|
||||
mongodb_systemlog_logappend: 'true'
|
||||
mongodb_systemlog_logrotate: reopen
|
||||
|
||||
|
||||
|
||||
mongodb_cluster_enabled: False
|
||||
mongodb_replicaset: storagedev
|
||||
mongodb_replica_keyfile: '{{ mongodb_dbpath }}/replica_keyfile'
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
- name: Install the cron job that manages log files rotation
|
||||
template: src=mongo_log_rotate.sh.j2 dest=/etc/cron.daily/mongo_log_rotate owner=root group=root mode=0555
|
||||
when: not mongodb_systemlog_external_logrotate
|
||||
tags: [ 'mongodb', 'mongo_logrotate' ]
|
||||
|
||||
- name: Ensure mongodb is started
|
||||
|
|
|
@ -16,10 +16,14 @@ storage:
|
|||
# where to write logging data.
|
||||
systemLog:
|
||||
destination: {{ mongodb_systemlog_destination }}
|
||||
logAppend: {{ mongodb_systemlog_logappend }}
|
||||
path: {{ mongodb_logpath }}
|
||||
logRotate: {{ mongodb_systemlog_logrotate }}
|
||||
|
||||
{% if mongodb_systemlog_external_logrotate %}
|
||||
logRotate: rename
|
||||
logAppend: false
|
||||
{% else %}
|
||||
logRotate: reopen
|
||||
logAppend: true
|
||||
{% endif %}
|
||||
# network interfaces
|
||||
net:
|
||||
port: {{ mongodb_tcp_port }}
|
||||
|
|
Loading…
Reference in New Issue