logrotate/tasks/main.yml
Knut Ahlers 258f0604a1
Skip check execution on logrotate <3.9.0
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-03-19 15:15:47 +01:00

24 lines
586 B
YAML

---
- name: Ensure logrotate is installed
apt:
name: logrotate
- name: Get logrotate version
command: 'logrotate --version'
changed_when: no
register: logrotate_version
- 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
when: not '3.8.' in logrotate_version.stderr
...