dmitrii-ageev.logrotate

dmitrii-ageev.logrotate

This role sets up logrotate and creates extra scripts for rotating logs.

The main purposes of this role are to:

  • Ensure that logrotate is installed and is set to run automatically in cron.
  • Simplify logrotate configuration by allowing per-application files in /etc/logrotate.d.
  • Manage log files for standard installations.

Requirements

You need root access to use this role.

Role Variables

logrotate__files: A list of logrotate files and the settings to use for rotation.

  • name: The name of the file that will be placed in /etc/logrotate.d/.
  • state: If you set this to 'absent', the file will be removed from the /etc/logrotate.d/ directory.
  • path: A list of path patterns for log rotation.
  • options: A list of settings for logrotate. Check the logrotate manual for details.
  • scripts: A dictionary of scripts for logrotate in the format section_name: 'executed command'.

Example Playbook

You can use this role in a playbook or call it from another role by declaring it as a dependency in the meta file.

---
- hosts: all
  become: true
  roles:
    - role: dmitrii-ageev.logrotate
      logrotate__files:
        - name: glusterfs
          path:
            - /var/log/glusterfs/samples/*.samp
            - /var/log/glusterfs/bricks/*.log
          options:
            - daily
            - rotate 3
            - sharedscripts
            - missingok
            - compress
            - delaycompress
          scripts: 
            postrotate: systemctl reload glusterfs
...

License

GNU General Public License v2.0

Author Information

Dmitrii Ageev d.ageev@gmail.com

Informazioni sul progetto

This role will setup logrotate and create additional rotation scripts.

Installa
ansible-galaxy install dmitrii-ageev.logrotate
Licenza
gpl-2.0
Download
147
Proprietario