arillso.logrotate

Ansible Role: logrotate

Build Status license Ansible Galaxy Ansible Role

Description

This role installs and sets up logrotate.

Installation

To install, run:

ansible-galaxy install arillso.logrotate

Requirements

No special requirements.

Role Variables

Include Files

Set the path for the include files.

logrotate_include_dir: /etc/logrotate.d

Global Configuration

Turn on/off the global configuration for /etc/logrotate.conf.

logrotate_global_config: true

Hourly Rotation

Turn on/off hourly rotation using cron.

logrotate_use_hourly_rotation: false

Logrotate Options

Global options you can set.

logrotate_options:
  - weekly
  - rotate 4
  - create
  - dateext
  - su root syslog

Package Name

The name of the package to install logrotate.

logrotate_package: logrotate

Default Configuration

For wtmp logs:

logrotate_wtmp_enable: true
logrotate_wtmp:
  logs:
    - /var/log/wtmp
  options:
    - missingok
    - monthly
    - create 0664 root utmp
    - rotate 1

For btmp logs:

logrotate_btmp_enable: true
logrotate_btmp:
  logs:
    - /var/log/btmp
  options:
    - missingok
    - monthly
    - create 0660 root utmp
    - rotate 1

Application Configuration

You can add more applications to be rotated.

logrotate_applications: []

Example Application

Here’s an example of how to add log rotation for an application.

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

Dependencies

No dependencies.

Example Playbook

Here's a simple playbook to use this role.

- hosts: all
  roles:
    - arillso.logrotate

Author

License

This project is under the MIT License. Check the LICENSE file for details.

(c) 2019, Arillso

Informazioni sul progetto

Ansible role for installs and configures logratet on Linux

Installa
ansible-galaxy install arillso.logrotate
Licenza
mit
Download
1.2M
Proprietario