From bed00b1db00c96933dca4ee781ba38dd6b556bf2 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Mon, 12 Oct 2020 16:03:11 +0200 Subject: [PATCH] Add a logrotate entry. Move the default logs dir to /var/log/roundcube --- README.md | 12 +++++++++--- defaults/main.yml | 4 ++-- tasks/roundcube-install.yml | 5 ++++- templates/roundcube-logrotate.j2 | 9 +++++++++ 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 templates/roundcube-logrotate.j2 diff --git a/README.md b/README.md index 35d5391..ae50caa 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,17 @@ -Role Name +ansible-role-roundcube ========= A role that installs the RoundCube webmail, +To upgrade, run the playbook with the following options: `-e roundcube_upgrade=True -e roundcube_old_version='version_number'` + Role Variables -------------- The most important variables are listed below: ``` yaml -roundcube_version: 1.4.7 +roundcube_version: 1.4.9 roundcube_upgrade: False roundcube_dist: 'roundcubemail-{{ roundcube_version }}' roundcube_dist_filename: '{{ roundcube_dist }}-complete.tar.gz' @@ -59,7 +61,11 @@ roundcube_memcache_hosts: Dependencies ------------ -None +* php-fpm +* nginx +* redis (optional) +* memcached (optional) +* postgresql (optional) License ------- diff --git a/defaults/main.yml b/defaults/main.yml index 7db4c33..7b47def 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,5 @@ --- -roundcube_version: 1.4.7 +roundcube_version: 1.4.9 roundcube_upgrade: False roundcube_dist: 'roundcubemail-{{ roundcube_version }}' roundcube_dist_filename: '{{ roundcube_dist }}-complete.tar.gz' @@ -11,7 +11,7 @@ roundcube_web_basedir: /var/www/html roundcube_web_root: '{{ roundcube_web_basedir }}/roundcube' roundcube_data_base_dir: /srv roundcube_data_dir: '{{ roundcube_data_base_dir }}/roundcube' -roundcube_logs_dir: '{{ roundcube_data_dir }}/logs' +roundcube_logs_dir: '/var/log/roundcube' roundcube_temp_dir: '{{ roundcube_data_dir }}/temp' roundcube_skin_logo: 'null' diff --git a/tasks/roundcube-install.yml b/tasks/roundcube-install.yml index 3438715..4d87036 100644 --- a/tasks/roundcube-install.yml +++ b/tasks/roundcube-install.yml @@ -21,6 +21,10 @@ - '{{ roundcube_logs_dir }}' - '{{ roundcube_temp_dir }}' + - name: Install a logrotate entry for the roundcube logs + template: src=roundcube-logrotate.j2 dest=/etc/logrotate.d/roundcube mode='0644' owner=root group=root + tags: [ 'roundcube', 'roundcube_logrotate' ] + - name: Unpack the roundcube archive unarchive: remote_src=yes src={{ roundcube_download_url }} dest={{ roundcube_data_dir }} owner=root group=root args: @@ -90,4 +94,3 @@ - roundcube_old_version is defined - roundcube_upgrade | bool tags: [ 'roundcube', 'roundcube_upgrade' ] - diff --git a/templates/roundcube-logrotate.j2 b/templates/roundcube-logrotate.j2 new file mode 100644 index 0000000..3a1c615 --- /dev/null +++ b/templates/roundcube-logrotate.j2 @@ -0,0 +1,9 @@ +{{ roundcube_logs_dir }}/*.log { + weekly + missingok + rotate 52 + compress + maxsize 1G + notifempty + create 0640 {{ roundcube_user }} {{ roundcube_user }} +}