From fc8d2164703e2501e9149b27b24c17eb40759a42 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Fri, 18 Sep 2015 18:45:32 +0200 Subject: [PATCH] library/roles/redmine/templates/unicorn-logrotate.j2: add a logrotate rule for the unicorn logs --- redmine/tasks/unicorn.yml | 46 +++++++------------------- redmine/templates/unicorn-logrotate.j2 | 9 +++++ 2 files changed, 21 insertions(+), 34 deletions(-) create mode 100644 redmine/templates/unicorn-logrotate.j2 diff --git a/redmine/tasks/unicorn.yml b/redmine/tasks/unicorn.yml index 295d580..4f0c483 100644 --- a/redmine/tasks/unicorn.yml +++ b/redmine/tasks/unicorn.yml @@ -4,66 +4,44 @@ with_items: - unicorn when: ruby_use_unicorn - tags: - - ruby - - redmine - - unicorn + tags: [ 'ruby', 'redmine', 'unicorn' ] - name: Create the unicorn log directory file: dest={{ unicorn_log_dir }} state=directory owner={{ redmine_user }} group={{ redmine_user }} mode=0750 - tags: - - ruby - - redmine - - unicorn + tags: [ 'ruby', 'redmine', 'unicorn' ] - name: Create the unicorn pid directory file: dest=/var/run/unicorn state=directory owner={{ redmine_user }} group={{ redmine_user }} mode=0750 - tags: - - ruby - - redmine - - unicorn + tags: [ 'ruby', 'redmine', 'unicorn' ] - name: Install the unicorn startup file for redmine copy: src=redmine.init dest=/etc/init.d/redmine owner=root group=root mode=0755 when: ruby_use_unicorn - tags: - - ruby - - redmine - - unicorn + tags: [ 'ruby', 'redmine', 'unicorn' ] - name: Install the unicorn defaults file template: src=unicorn-redmine.default.j2 dest=/etc/default/unicorn-redmine owner=root group=root mode=0644 notify: Reload unicorn when needed - tags: - - ruby - - redmine - - unicorn - - unicorn_conf + tags: [ 'ruby', 'redmine', 'unicorn', 'unicorn_conf' ] +- name: Install the unicorn logrotate file + template: src=unicorn-logrotate.j2 dest=/etc/logrotate.d/unicorn-redmine owner=root group=root mode=0644 + tags: [ 'ruby', 'redmine', 'unicorn', 'unicorn_conf' ] + - name: Install the unicorn config template: src=unicorn.conf.rb.j2 dest={{ redmine_glob_root_dir }}/{{ redmine_inst_dir }}/config/unicorn.conf.rb owner=root group=root mode=0644 when: ruby_use_unicorn notify: Reload unicorn when needed - tags: - - ruby - - redmine - - unicorn - - unicorn_conf + tags: [ 'ruby', 'redmine', 'unicorn', 'unicorn_conf' ] - name: Install the needed apache modules apache2_module: name={{ item }} state=present with_items: unicorn_apache_modules when: ruby_use_unicorn notify: apache2 reload - tags: - - apache - - redmine - - unicorn + tags: [ 'ruby', 'redmine', 'unicorn' ] - name: Ensure that the unicorn service is enabled and running service: name=redmine state=started enabled=yes when: ruby_use_unicorn - tags: - - ruby - - redmine - - unicorn + tags: [ 'ruby', 'redmine', 'unicorn' ] diff --git a/redmine/templates/unicorn-logrotate.j2 b/redmine/templates/unicorn-logrotate.j2 new file mode 100644 index 0000000..b145822 --- /dev/null +++ b/redmine/templates/unicorn-logrotate.j2 @@ -0,0 +1,9 @@ +{{ unicorn_log_dir }}/*.log { + weekly + missingok + rotate 52 + compress + delaycompress + notifempty + copytruncate +}