Ansible Role linuxfabrik.lfops.logrotate¶
This role ensures that logrotate is installed and configured for main classic system log files like /var/log/cron, /var/log/maillog or /var/log/messages.
Additionally, this role allows you to deploy custom logrotate configs which are placed under {{ inventory_dir }}/host_files/{{ inventory_hostname }}/etc/logrotate.d on the Ansible control node. Keep in mind that later config files may override the options given in earlier files, so the order in which the logrotate config files are listed is important.
Tags¶
logrotate
- Set platform/version specific variables.
- Install logrotate.
- Copy logrotate.conf template to /etc.
- Copy system logrotate templates to /etc/logrotate.d.
- Check if custom logrotate configs for {{ inventory_hostname }} exist.
- Copy the custom logrotate configs to /etc/logrotate.d.
- Triggers: none.
Optional Role Variables¶
logrotate__rotate
- Log files are rotated
countdays before being removed or mailed to the address specified in alogrotatemail directive. If count is0, old versions are removed rather than rotated. If count is-1, old logs are not removed at all (use with caution, may waste performance and disk space). - Type: Number.
- Default:
14
Example:
# optional
logrotate__rotate: 7