diff --git a/roles/mgrote.cv4pve-autosnap/tasks/main.yml b/roles/mgrote.cv4pve-autosnap/tasks/main.yml index ca94002b..346e439b 100644 --- a/roles/mgrote.cv4pve-autosnap/tasks/main.yml +++ b/roles/mgrote.cv4pve-autosnap/tasks/main.yml @@ -50,24 +50,11 @@ access_time: preserve modification_time: preserve - - name: Add Log to be Rotated - become: true - ansible.builtin.blockinfile: - path: /etc/logrotate.d/cv4pve-autosnap - state: present - create: yes + - name: copy logrotate config + become: yes + ansible.builtin.template: + src: logrotate_cv4pve + dest: /etc/logrotate.d/cv4pve-autosnap owner: root group: root mode: 0644 - block: | - /var/log/cv4pve-autosnap.log { - su root root - create 0640 root root - rotate 4 - weekly - compress - missingok - notifempty - dateext - dateyesterday - } diff --git a/roles/mgrote.cv4pve-autosnap/templates/logrotate_cv4pve b/roles/mgrote.cv4pve-autosnap/templates/logrotate_cv4pve new file mode 100644 index 00000000..892a5133 --- /dev/null +++ b/roles/mgrote.cv4pve-autosnap/templates/logrotate_cv4pve @@ -0,0 +1,11 @@ +/var/log/cv4pve-autosnap.log { + su root root + create 0640 root root + rotate 4 + weekly + compress + missingok + notifempty + dateext + dateyesterday +} diff --git a/roles/mgrote.ecc-rasdaemon/tasks/main.yml b/roles/mgrote.ecc-rasdaemon/tasks/main.yml index 4de32f33..9a2363ba 100644 --- a/roles/mgrote.ecc-rasdaemon/tasks/main.yml +++ b/roles/mgrote.ecc-rasdaemon/tasks/main.yml @@ -1,3 +1,4 @@ +--- - name: Install rasdaemon become: true ansible.builtin.package: @@ -27,27 +28,14 @@ access_time: preserve modification_time: preserve - - name: Add rasdaemon Log to be Rotated - become: true - ansible.builtin.blockinfile: - path: /etc/logrotate.d/rasdaemon - state: present - create: yes + - name: copy logrotate config + become: yes + ansible.builtin.template: + src: logrotate_rasdaemon + dest: /etc/logrotate.d/rasdaemon owner: root group: root mode: 0644 - block: | - /var/log/rasdaemon.log { - su root root - create 0640 root root - rotate 4 - weekly - compress - missingok - notifempty - dateext - dateyesterday - } - name: rasdaemon-cron kopieren become: yes diff --git a/roles/mgrote.ecc-rasdaemon/templates/logrotate_rasdaemon b/roles/mgrote.ecc-rasdaemon/templates/logrotate_rasdaemon new file mode 100644 index 00000000..42c6445c --- /dev/null +++ b/roles/mgrote.ecc-rasdaemon/templates/logrotate_rasdaemon @@ -0,0 +1,11 @@ +/var/log/rasdaemon.log { + su root root + create 0640 root root + rotate 4 + weekly + compress + missingok + notifempty + dateext + dateyesterday +} diff --git a/roles/mgrote.musterrolle/tasks/main.yml b/roles/mgrote.musterrolle/tasks/main.yml index 9fc80561..2354fdae 100644 --- a/roles/mgrote.musterrolle/tasks/main.yml +++ b/roles/mgrote.musterrolle/tasks/main.yml @@ -32,27 +32,14 @@ access_time: preserve modification_time: preserve - - name: Add restic Log to be Rotated - become: true - ansible.builtin.blockinfile: - path: /etc/logrotate.d/restic - state: present - create: yes + - name: copy logrotate config + become: yes + ansible.builtin.template: + src: logrotate_chrony + dest: /etc/logrotate.d/chrony owner: root group: root mode: 0644 - block: | - /var/log/restic.log { - su root root - create 0640 root root - rotate 4 - weekly - compress - missingok - notifempty - dateext - dateyesterday - } diff --git a/roles/mgrote.ntp_chrony_client/tasks/main.yml b/roles/mgrote.ntp_chrony_client/tasks/main.yml index 97930dec..5312772c 100644 --- a/roles/mgrote.ntp_chrony_client/tasks/main.yml +++ b/roles/mgrote.ntp_chrony_client/tasks/main.yml @@ -29,12 +29,14 @@ mode: 0755 notify: restart_chrony - - name: copy logrotate config become: yes ansible.builtin.template: src: logrotate_chrony dest: /etc/logrotate.d/chrony + owner: root + group: root + mode: 0644 - name: Create chrony driftfile folder become: yes diff --git a/roles/mgrote.ntp_chrony_server/tasks/main.yml b/roles/mgrote.ntp_chrony_server/tasks/main.yml index 97930dec..75b6cf76 100644 --- a/roles/mgrote.ntp_chrony_server/tasks/main.yml +++ b/roles/mgrote.ntp_chrony_server/tasks/main.yml @@ -29,13 +29,14 @@ mode: 0755 notify: restart_chrony - - name: copy logrotate config become: yes ansible.builtin.template: src: logrotate_chrony dest: /etc/logrotate.d/chrony - + owner: root + group: root + mode: 0644 - name: Create chrony driftfile folder become: yes file: diff --git a/roles/mgrote.restic/tasks/main.yml b/roles/mgrote.restic/tasks/main.yml index 37860733..22a06b4b 100644 --- a/roles/mgrote.restic/tasks/main.yml +++ b/roles/mgrote.restic/tasks/main.yml @@ -76,24 +76,11 @@ access_time: preserve modification_time: preserve - - name: Add restic Log to be Rotated - become: true - ansible.builtin.blockinfile: - path: /etc/logrotate.d/restic - state: present - create: yes + - name: copy logrotate config + become: yes + ansible.builtin.template: + src: logrotate_restic + dest: /etc/logrotate.d/restic owner: root group: root mode: 0644 - block: | - /var/log/restic.log { - su root root - create 0640 root root - rotate 4 - weekly - compress - missingok - notifempty - dateext - dateyesterday - } diff --git a/roles/mgrote.restic/templates/logrotate_restic b/roles/mgrote.restic/templates/logrotate_restic new file mode 100644 index 00000000..a239ebe7 --- /dev/null +++ b/roles/mgrote.restic/templates/logrotate_restic @@ -0,0 +1,11 @@ +/var/log/restic.log { + su root root + create 0640 root root + rotate 4 + weekly + compress + missingok + notifempty + dateext + dateyesterday +} diff --git a/roles/mgrote.zfs_sanoid/tasks/main.yml b/roles/mgrote.zfs_sanoid/tasks/main.yml index fe53562f..180bcaed 100644 --- a/roles/mgrote.zfs_sanoid/tasks/main.yml +++ b/roles/mgrote.zfs_sanoid/tasks/main.yml @@ -63,27 +63,14 @@ access_time: preserve modification_time: preserve - - name: Add Sanoid Log to be Rotated - become: true - ansible.builtin.blockinfile: - path: /etc/logrotate.d/sanoid - state: present - create: yes + - name: copy logrotate config + become: yes + ansible.builtin.template: + src: logrotate_sanoid + dest: /etc/logrotate.d/sanoid owner: root group: root mode: 0644 - block: | - /var/log/sanoid-cron.log { - su root root - create 0640 root root - rotate 4 - weekly - compress - missingok - notifempty - dateext - dateyesterday - } - name: Generate Sanoid Cron Scripts become: true diff --git a/roles/mgrote.zfs_sanoid/templates/logrotate_sanoid b/roles/mgrote.zfs_sanoid/templates/logrotate_sanoid new file mode 100644 index 00000000..36efe148 --- /dev/null +++ b/roles/mgrote.zfs_sanoid/templates/logrotate_sanoid @@ -0,0 +1,11 @@ +/var/log/sanoid-cron.log { + su root root + create 0640 root root + rotate 4 + weekly + compress + missingok + notifempty + dateext + dateyesterday +}