diff --git a/roles/autoradio/files/icecast2.cron b/roles/autoradio/files/icecast2.cron new file mode 100644 index 0000000000000000000000000000000000000000..a0d82160e2d637e72082dfb1e92778b4131a6b78 --- /dev/null +++ b/roles/autoradio/files/icecast2.cron @@ -0,0 +1,3 @@ +MAILTO="" +7 5 * * * root find /var/log/icecast2/ -type f -mtime +7 -delete + diff --git a/roles/autoradio/files/icecast2.logrotate b/roles/autoradio/files/icecast2.logrotate deleted file mode 100644 index 0f41d96bf257f6f7de8c11a39aa9998b208f430c..0000000000000000000000000000000000000000 --- a/roles/autoradio/files/icecast2.logrotate +++ /dev/null @@ -1,12 +0,0 @@ -/var/log/icecast2/*.log { - daily - missingok - rotate 1 - postrotate - if pgrep icecast2 >/dev/null; then - invoke-rc.d --quiet icecast2 reload > /dev/null - fi - endscript - compress - notifempty -} diff --git a/roles/autoradio/files/mtail.logrotate b/roles/autoradio/files/mtail.logrotate new file mode 100644 index 0000000000000000000000000000000000000000..9882446153cf78e7dcb594a4af004b5957cd0763 --- /dev/null +++ b/roles/autoradio/files/mtail.logrotate @@ -0,0 +1,12 @@ +/var/log/mtail/mtail.log { + daily + missingok + rotate 1 + postrotate + if pgrep mtail >/dev/null; then + invoke-rc.d --quiet mtail restart > /dev/null + fi + endscript + compress + notifempty +} diff --git a/roles/autoradio/tasks/main.yml b/roles/autoradio/tasks/main.yml index af5c52d275a0b978f75ae9aa6bc77b9916dbc537..e94692a45c3fbe1feba3973430bf95703c500495 100644 --- a/roles/autoradio/tasks/main.yml +++ b/roles/autoradio/tasks/main.yml @@ -18,11 +18,6 @@ - include_tasks: local_install.yml when: "source_repository_path is defined" -- name: Set up icecast logrotate policy - copy: - src: icecast2.logrotate - dest: /etc/logrotate.d/icecast2 - - name: Set up icecast static files copy: src: "icecast/{{ item }}" @@ -58,6 +53,11 @@ dest: /etc/cron.d/autoradio-backup when: "backup_repository is defined" +- name: Setup icecast log clearing cron job + copy: + src: "icecast2.cron" + dest: "/etc/cron.d/icecast2" + - import_tasks: mtail.yml - name: Install ip block script diff --git a/roles/autoradio/tasks/mtail.yml b/roles/autoradio/tasks/mtail.yml index bd88359eddc4f4b25887c4c9fb1d58d327144dda..4917faf675482a379be92cfdd25474635ff85407 100644 --- a/roles/autoradio/tasks/mtail.yml +++ b/roles/autoradio/tasks/mtail.yml @@ -11,6 +11,11 @@ dest: "/etc/default/mtail" notify: "restart mtail" +- name: Install mtail logrotate config + copy: + src: "mtail.logrotate" + dest: "/etc/logrotate.d/mtail" + - name: Install mtail programs copy: src: "icecast2.mtail"