Skip to content

Commit

Permalink
enable hourly logrotate
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeniy Bessonov committed Jul 19, 2019
1 parent 3a47e26 commit af4f423
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ None
| Variable | Default | Comments (type) |
| :--------------------- | :-------------------------------------------------------------------------------------------------- | :--------------------------------------- |
| logrotate_options | [ 'weekly', 'su root syslog', 'rotate 4', 'create' ] | List of default options |
| use_hourly_rotation | false | Enable hourly rotation with cron |
| logrotate_wtmp | { logs: ['/var/log/wtmp'], options: ['missingok', 'monthly', 'create 0664 root utmp', 'rotate 1'] } | Logrotate options for wtmp |
| logrotate_btmp | { logs: ['/var/log/btmp'], options: ['missingok', 'monthly', 'create 0660 root utmp', 'rotate 1'] } | Logrotate options for btmp |
| logrotate_applications | [] | Logrotate options for other applications |
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
# defaults file for arillso.logrotate

use_hourly_rotation: false

logrotate_wtmp:
logs:
- /var/log/wtmp
Expand Down
11 changes: 11 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@
- '{{ logrotate_applications }}'
tags:
- configuration

- name: Set logrotate hourly state
set_fact:
hourly_link_state: link
when: use_hourly_rotation

- name: Symlink for hourly rotation
file:
path: "/etc/cron.hourly/logrotate"
src: "/etc/cron.daily/logrotate"
state: "{{ hourly_link_state }}"
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
# vars file for arillso.logrotate
hourly_link_state: absent

0 comments on commit af4f423

Please sign in to comment.