ageres210784.logrotate
Ansible Role: logrotate
Description
This role installs and sets up logrotate.
Installation
To install, run:
ansible-galaxy install arillso.logrotate
Requirements
No special requirements.
Role Variables
Include Files
Set the path for include files.
logrotate_include_dir: /etc/logrotate.d
Global Configuration
Turn global configuration on or off for /etc/logrotate.conf
.
logrotate_global_config: true
Hourly Rotation
You can enable or disable hourly log rotation with cron.
logrotate_use_hourly_rotation: false
For Ubuntu version 20.04 or later, enable hourly rotation with systemd.
Set this to true:
logrotate_timer:
options:
- OnCalendar=hourly
- Persistent=true
Logrotate Options
Set global options for log rotation.
logrotate_options:
- weekly
- rotate 4
- create
- dateext
- su root syslog
Package Name
Specify the package name for logrotate
.
logrotate_package: logrotate
Default Config
For wtmp
log:
logrotate_wtmp_enable: true
logrotate_wtmp:
logs:
- /var/log/wtmp
options:
- missingok
- monthly
- create 0664 root utmp
- rotate 1
For btmp
log:
logrotate_btmp_enable: true
logrotate_btmp:
logs:
- /var/log/btmp
options:
- missingok
- monthly
- create 0660 root utmp
- rotate 1
Application Config
You can add more log files for log rotation.
logrotate_applications: []
Example
Here’s how you can define additional applications:
logrotate_applications:
- name: name-your-log-rotate-application
definitions:
- logs:
- /var/log/apt/term.log
- /var/log/apt/history.log
options:
- su user group
- rotate 12
- monthly
- missingok
- notifempty
postrotate:
- /path/to/some/script
Dependencies
None
Example Playbook
Here’s an example playbook:
- hosts: all
roles:
- arillso.logrotate
Author
License
This project is licensed under the MIT License. See the LICENSE file for the full license details.
Copyright
(c) 2019, Arillso
Informazioni sul progetto
Ansible role for installs and configures logratet on Linux
Installa
ansible-galaxy install ageres210784.logrotate
Licenza
mit
Download
173
Proprietario