Rotate mongodb logs.

This commit is contained in:
Kirill Klenov 2014-07-10 20:07:35 +04:00
parent e7795d144d
commit 513e601405
4 changed files with 33 additions and 0 deletions

View File

@ -11,6 +11,7 @@ Ansible role which manage [MongoDB](http://www.mongodb.org/)
#### Variables
```yaml
mongodb_enabled: yes
mongodb_packages:
- python-selinux
- python-pymongo
@ -33,6 +34,16 @@ mongodb_noscripting: false
mongodb_notablescan: false
mongodb_noprealloc: false
mongodb_replSet: "" # Set for enable replication
# Log rotation
mongodb_logrotate: yes # Rotate mongodb logs.
mongodb_logrotate_options:
- compress
- copytruncate
- daily
- dateext
- rotate 7
- size 10M
```
#### Usage

View File

@ -23,3 +23,13 @@ mongodb_noscripting: false
mongodb_notablescan: false
mongodb_noprealloc: false
mongodb_replSet: "" # Set for enable replication
# Log rotation
mongodb_logrotate: yes # Rotate mongodb logs.
mongodb_logrotate_options:
- compress
- copytruncate
- daily
- dateext
- rotate 7
- size 10M

View File

@ -3,3 +3,7 @@
- name: Configure mongodb
template: src=mongodb.conf.j2 dest=/etc/mongodb.conf owner=root group=root mode=0644
notify: mongodb reload
- name: Configure log rotation
template: src=logrotate.conf.j2 dest=/etc/logrotate.d/mongodb.conf
when: mongodb_logrotate

View File

@ -0,0 +1,8 @@
# This file was generated by Ansible for {{ ansible_fqdn }}
# Do NOT modify this file by hand!
{{mongodb_logpath}} {
{% for option in mongodb_logrotate_options %}
{{ option }}
{% endfor %}
}