2018-01-13 12:32:01 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Ensure logrotate is installed
|
|
|
|
apt:
|
|
|
|
name: logrotate
|
2018-03-19 15:11:48 +00:00
|
|
|
cache_valid_time: 86400
|
2018-01-13 12:32:01 +00:00
|
|
|
|
2018-03-19 14:13:04 +00:00
|
|
|
- name: Get logrotate version
|
|
|
|
command: 'logrotate --version'
|
|
|
|
changed_when: no
|
|
|
|
register: logrotate_version
|
|
|
|
|
2018-01-13 12:32:01 +00:00
|
|
|
- name: Install custom logrotate files
|
|
|
|
template:
|
|
|
|
src: templates/logrotate.j2
|
|
|
|
dest: '/etc/logrotate.d/{{ item.name }}'
|
|
|
|
with_items: '{{ logrotate_configs | default([]) }}'
|
|
|
|
|
|
|
|
- name: Test custom configurations
|
|
|
|
command: 'logrotate -d /etc/logrotate.d/{{ item.name }}'
|
|
|
|
with_items: '{{ logrotate_configs | default([]) }}'
|
|
|
|
changed_when: no
|
2018-03-19 14:13:04 +00:00
|
|
|
when: not '3.8.' in logrotate_version.stderr
|
2018-01-13 12:32:01 +00:00
|
|
|
|
|
|
|
...
|