Import github.com/arillso/ansible.logrotate

at version 1.5.2 (commit 038649f
This commit is contained in:
Serge van Ginderachter 2020-09-09 16:17:43 +02:00
parent 008fdbaa1f
commit b0e5245e4e
No known key found for this signature in database
GPG key ID: 3148E9B9232D65E5
9 changed files with 248 additions and 0 deletions

63
tasks/main.yml Normal file
View file

@ -0,0 +1,63 @@
---
- name: add OS specific variables
include_vars: '{{ loop_vars }}'
with_first_found:
- files:
- '{{ distribution }}-{{ distribution_version }}.yml'
- '{{ distribution }}-{{ distribution_major_version }}.yml'
- '{{ distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- '{{ ansible_system }}.yml'
- 'defaults.yml'
paths:
- 'vars'
loop_control:
loop_var: loop_vars
vars:
distribution: '{{ ansible_distribution }}'
distribution_version: '{{ ansible_distribution_version }}'
distribution_major_version: '{{ ansible_distribution_major_version }}'
tags:
- configuration
- packages
- name: 'install logrotate packages'
become: true
package:
name: '{{ logrotate_package }}'
state: present
register: register_install_package
until: register_install_package is succeeded
retries: 3
tags:
- packages
- name: 'create logrotate configuration file'
become: true
template:
src: 'etc/logrotate.conf.j2'
dest: '/etc/logrotate.conf'
owner: root
group: root
mode: 0644
tags:
- configuration
- name: 'create logrotate application configuration files'
become: true
template:
src: 'etc/logrotate.d/application.j2'
dest: '/etc/logrotate.d/{{ item.name }}'
owner: root
group: root
mode: 0644
with_items:
- '{{ logrotate_applications }}'
tags:
- configuration
- name: Symlink for hourly rotation
file:
path: "/etc/cron.hourly/logrotate"
src: "/etc/cron.daily/logrotate"
state: "{{ 'link' if logrotate_use_hourly_rotation else 'absent' }}"