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 access_time: preserve
modification_time: preserve modification_time: preserve
- name: Add Log to be Rotated - name: copy logrotate config
become: true become: yes
ansible.builtin.blockinfile: ansible.builtin.template:
path: /etc/logrotate.d/cv4pve-autosnap src: logrotate_cv4pve
state: present dest: /etc/logrotate.d/cv4pve-autosnap
create: yes
owner: root owner: root
group: root group: root
mode: 0644 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 - name: Install rasdaemon
become: true become: true
ansible.builtin.package: ansible.builtin.package:
@ -27,27 +28,14 @@
access_time: preserve access_time: preserve
modification_time: preserve modification_time: preserve
- name: Add rasdaemon Log to be Rotated - name: copy logrotate config
become: true become: yes
ansible.builtin.blockinfile: ansible.builtin.template:
path: /etc/logrotate.d/rasdaemon src: logrotate_rasdaemon
state: present dest: /etc/logrotate.d/rasdaemon
create: yes
owner: root owner: root
group: root group: root
mode: 0644 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 - name: rasdaemon-cron kopieren
become: yes 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 access_time: preserve
modification_time: preserve modification_time: preserve
- name: Add restic Log to be Rotated - name: copy logrotate config
become: true become: yes
ansible.builtin.blockinfile: ansible.builtin.template:
path: /etc/logrotate.d/restic src: logrotate_chrony
state: present dest: /etc/logrotate.d/chrony
create: yes
owner: root owner: root
group: root group: root
mode: 0644 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 mode: 0755
notify: restart_chrony notify: restart_chrony
- name: copy logrotate config - name: copy logrotate config
become: yes become: yes
ansible.builtin.template: ansible.builtin.template:
src: logrotate_chrony src: logrotate_chrony
dest: /etc/logrotate.d/chrony dest: /etc/logrotate.d/chrony
owner: root
group: root
mode: 0644
- name: Create chrony driftfile folder - name: Create chrony driftfile folder
become: yes become: yes

View file

@ -29,13 +29,14 @@
mode: 0755 mode: 0755
notify: restart_chrony notify: restart_chrony
- name: copy logrotate config - name: copy logrotate config
become: yes become: yes
ansible.builtin.template: ansible.builtin.template:
src: logrotate_chrony src: logrotate_chrony
dest: /etc/logrotate.d/chrony dest: /etc/logrotate.d/chrony
owner: root
group: root
mode: 0644
- name: Create chrony driftfile folder - name: Create chrony driftfile folder
become: yes become: yes
file: file:

View file

@ -76,24 +76,11 @@
access_time: preserve access_time: preserve
modification_time: preserve modification_time: preserve
- name: Add restic Log to be Rotated - name: copy logrotate config
become: true become: yes
ansible.builtin.blockinfile: ansible.builtin.template:
path: /etc/logrotate.d/restic src: logrotate_restic
state: present dest: /etc/logrotate.d/restic
create: yes
owner: root owner: root
group: root group: root
mode: 0644 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 access_time: preserve
modification_time: preserve modification_time: preserve
- name: Add Sanoid Log to be Rotated - name: copy logrotate config
become: true become: yes
ansible.builtin.blockinfile: ansible.builtin.template:
path: /etc/logrotate.d/sanoid src: logrotate_sanoid
state: present dest: /etc/logrotate.d/sanoid
create: yes
owner: root owner: root
group: root group: root
mode: 0644 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 - name: Generate Sanoid Cron Scripts
become: true 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
}