logcompress: configurable compression tool, default zstd
This commit is contained in:
parent
0ad6cbab1a
commit
6960f3797e
|
@ -1,3 +1,4 @@
|
||||||
|
---
|
||||||
has_hwrng: '{{ansible_virtualization_role != "guest" and ansible_local.devices.hwrng }}'
|
has_hwrng: '{{ansible_virtualization_role != "guest" and ansible_local.devices.hwrng }}'
|
||||||
is_virt_guest: '{{ansible_virtualization_role == "guest"}}'
|
is_virt_guest: '{{ansible_virtualization_role == "guest"}}'
|
||||||
is_container: '{{ansible_virtualization_role == "guest" and ansible_virtualization_type == "lxc"}}'
|
is_container: '{{ansible_virtualization_role == "guest" and ansible_virtualization_type == "lxc"}}'
|
||||||
|
@ -12,3 +13,4 @@ sshd_host_keys:
|
||||||
- '/etc/ssh/ssh_host_ed25519_key'
|
- '/etc/ssh/ssh_host_ed25519_key'
|
||||||
sshd_pubkey_authentication: 'yes'
|
sshd_pubkey_authentication: 'yes'
|
||||||
apt_clean_after_install: false
|
apt_clean_after_install: false
|
||||||
|
logcompress_algo: 'zstd'
|
||||||
|
|
|
@ -111,6 +111,7 @@
|
||||||
- vim-nox
|
- vim-nox
|
||||||
- '{{ [] if is_container else ["xfsdump", "xfsprogs"] }}'
|
- '{{ [] if is_container else ["xfsdump", "xfsprogs"] }}'
|
||||||
- '{{ needed_debs if needed_debs is defined else [] }}'
|
- '{{ needed_debs if needed_debs is defined else [] }}'
|
||||||
|
- '{{ logcompress_algo if logcompress_algo else [] }}'
|
||||||
|
|
||||||
# remove garbage:
|
# remove garbage:
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,18 @@
|
||||||
with_fileglob:
|
with_fileglob:
|
||||||
- "systemd/system/*"
|
- "systemd/system/*"
|
||||||
|
|
||||||
|
- name: install systemd-logcompress-jobs
|
||||||
|
template:
|
||||||
|
src: "{{item}}"
|
||||||
|
dest: /etc/systemd/system
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0644
|
||||||
|
with_fileglob:
|
||||||
|
- "systemd/system/*"
|
||||||
|
vars:
|
||||||
|
command: '{{ logcompress_command | default( logcompress_compression_commands[ logcompress_algo | default( "zstd") ] ) }}'
|
||||||
|
|
||||||
- name: enable services
|
- name: enable services
|
||||||
systemd:
|
systemd:
|
||||||
name: "{{item}}"
|
name: "{{item}}"
|
||||||
|
|
|
@ -3,4 +3,4 @@ Description=Compress old logs in /var/log/%%Y
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/find /var/log/ -regex '/var/log/2[0-9][0-9][0-9]/2[0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]' -mtime +0 -exec xz {} +
|
ExecStart=/usr/bin/find /var/log/ -regex '/var/log/2[0-9][0-9][0-9]/2[0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]' -mtime +0 -exec {{command}} {} +
|
|
@ -1,2 +1,8 @@
|
||||||
---
|
---
|
||||||
# vars file for system
|
# vars file for system
|
||||||
|
logcompress_compression_commands:
|
||||||
|
gzip: 'gzip -9'
|
||||||
|
bzip2: 'bzip2 -9'
|
||||||
|
xz: 'xz -9'
|
||||||
|
lz4: 'lz4 -9 --rm'
|
||||||
|
zstd: 'zstd -19 --rm'
|
||||||
|
|
Loading…
Reference in a new issue