arillso.logrotate
Ansible 角色: logrotate
描述
安装和配置 logrotate。
安装
ansible-galaxy install arillso.logrotate
要求
无。
角色变量
include 文件
包含文件的路径。
logrotate_include_dir: /etc/logrotate.d
logrotate_global_config
启用/禁用 /etc/logrotate.conf
的全局配置。
logrotate_global_config: true
logrotate_use_hourly_rotation
启用/禁用使用 cron 的每小时轮换。
logrotate_use_hourly_rotation: false
logrotate 选项
全局选项列表。
logrotate_options:
- weekly
- rotate 4
- create
- dateext
- su root syslog
软件包
安装 logrotate
的软件包名称。
logrotate_package: logrotate
默认配置
wtmp
的 logrotate:
logrotate_wtmp_enable: true
logrotate_wtmp:
logs:
- /var/log/wtmp
options:
- missingok
- monthly
- create 0664 root utmp
- rotate 1
btmp
的 logrotate:
logrotate_btmp_enable: true
logrotate_btmp:
logs:
- /var/log/btmp
options:
- missingok
- monthly
- create 0660 root utmp
- rotate 1
应用程序配置
可以添加更多的日志文件以进行轮换。
logrotate_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
依赖项
无
示例剧本
- hosts: all
roles:
- arillso.logrotate
作者
许可证
此项目遵循 MIT 许可证。请查看 LICENSE 文件以获取完整的许可证文本。
版权
(c) 2019, Arillso