logrotate: template statt blockinfile (#39)

Merge branch 'master' into logrotate

cv4

rasdaemon

musterrolle

rechte

restic

sanoid

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#39
Co-Authored-By: mg <mg@noreply.git.mgrote.net>
Co-Committed-By: mg <mg@noreply.git.mgrote.net>
This commit is contained in:
Michael Grote 2021-03-13 22:11:57 +01:00
parent c0ef189607
commit 0c016ea2b7
11 changed files with 76 additions and 93 deletions

View file

@ -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
}

View file

@ -0,0 +1,11 @@
/var/log/cv4pve-autosnap.log {
su root root
create 0640 root root
rotate 4
weekly
compress
missingok
notifempty
dateext
dateyesterday
}

View file

@ -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

View file

@ -0,0 +1,11 @@
/var/log/rasdaemon.log {
su root root
create 0640 root root
rotate 4
weekly
compress
missingok
notifempty
dateext
dateyesterday
}

View file

@ -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
}

View file

@ -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

View file

@ -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:

View file

@ -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
}

View file

@ -0,0 +1,11 @@
/var/log/restic.log {
su root root
create 0640 root root
rotate 4
weekly
compress
missingok
notifempty
dateext
dateyesterday
}

View file

@ -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

View file

@ -0,0 +1,11 @@
/var/log/sanoid-cron.log {
su root root
create 0640 root root
rotate 4
weekly
compress
missingok
notifempty
dateext
dateyesterday
}