Manage logrotated.d in Debian-like systems.
None
logrotated_logrotate_d_files
[default:{}
]:/etc/logrotated.d/*
A list of application-specific file declarationslogrotated_logrotate_d_files.key
: The name of the logrotated configuration file (e.gapache2
)logrotated_logrotate_d_files.key.{n}
[optional, default:[]
]: A section declarationlogrotated_logrotate_d_files.key.{n}.logs
[default:[]
]: The log files for this sectionlogrotated_logrotate_d_files.key.{n}.size
[optional]: Rotate logs when they reach this sizelogrotated_logrotate_d_files.key.{n}.daily
[optional]: Whether or not log files are rotated every daylogrotated_logrotate_d_files.key.{n}.weekly
[optional]: Whether or not log files are rotated weeklylogrotated_logrotate_d_files.key.{n}.monthly
[optional]: Whether or not log files are rotated monthlylogrotated_logrotate_d_files.key.{n}.yearly
[optional]: Whether or not log files are rotated yearlylogrotated_logrotate_d_files.key.{n}.missingok
[optional]: Whether or not to go on to the next log file without issuing an error message when the log file is missinglogrotated_logrotate_d_files.key.{n}.rotate
[optional]: Number of times log files are rotated (before being removed)logrotated_logrotate_d_files.key.{n}.compress
[optional]: Whether or not old versions of log files are compressedlogrotated_logrotate_d_files.key.{n}.delaycompress
[optional]: Whether or not to postpone compression of the previous log file to the next rotation cyclelogrotated_logrotate_d_files.key.{n}.copytruncate
[optional]: Whether or not to truncate the original log file to zero size in place after creating a copylogrotated_logrotate_d_files.key.{n}.notifempty
[optional]: Whether or not to not rotate the log if it is emptylogrotated_logrotate_d_files.key.{n}.create
[optional]: Whether or not the log file is created immediately after rotation wit the given mode, owner and grouplogrotated_logrotate_d_files.key.{n}.sharedscripts
[optional]: Whether or not the scripts are only run once, no matter how many logs match the wildcarded patternlogrotated_logrotate_d_files.key.{n}.scripts
[optional, default:{}
]: A hash of scriptslogrotated_logrotate_d_files.key.{n}.scripts.key
[required]: Action to run the script (e.gpostrotate
)logrotated_logrotate_d_files.key.{n}.scripts.key.{n}
[default:[]
]: List of lines with directives to execute
None
---
- hosts: all
roles:
- oefenweb.logrotated
---
- hosts: all
roles:
- oefenweb.logrotated
vars:
logrotated_logrotate_d_files:
apache2:
- logs:
- '/var/log/apache2/*.log'
weekly: true
missingok: true
rotate: 52
compress: true
delaycompress: true
notifempty: true
create: '640 root adm'
sharedscripts: true
scripts:
postrotate:
- 'if /etc/init.d/apache2 status > /dev/null ; then \'
- ' /etc/init.d/apache2 reload > /dev/null; \'
- 'fi;'
prerotate:
- 'if [ -d /etc/logrotate.d/httpd-prerotate ]; then \'
- ' run-parts /etc/logrotate.d/httpd-prerotate; \'
- 'fi;'
MIT
- Mark van Driel
- Mischa ter Smitten
Are welcome!