jobscore.logrotate

Logrotate

This is an Ansible role designed to install and set up Logrotate on an Ubuntu machine.

Requirements

No specific requirements.

Role Variables

  • name: The name of the Logrotate configuration file.

  • paths: A list of log file locations that will be handled by Logrotate.

    paths:
      - "/foo/bar/test.log"
      - "/foo/bar/dev.log"
    
  • frequency: How often the log will be rotated. Options are: daily, weekly, monthly, or yearly.

  • minsize: Log files will be rotated when they exceed a certain size (in bytes) and after an additional time period (daily, weekly, monthly, or yearly).

    minsize: 100M
    
  • maxsize: Log files will be rotated if they exceed a set size (in bytes) even if the specified time period hasn't passed.

    maxsize: 1G
    
  • rotate: The number of times log files will be rotated before they are deleted or sent by email.

    rotate: 7
    
  • extra_scripts: Additional scripts or configurations that are not part of the default settings for this role.

    extra_scripts: |
      create 644 user group
      postrotate
        <some scripts here>
      endscript
    

Dependencies

No dependencies.

Example Playbook

- name: Example logrotate
  hosts: all
  roles:
    - role: jobscore.logrotate
  vars:
    logrotate_config:
      - name: Rails logrotate
        paths:
          - "/var/log/rails.log"
        frequency: daily
        minsize: 100M
        rotate: 7
        extra_scripts: |
          create 644 app app
          sharedscripts
          postrotate
            echo "Hello"
          endscript

License

GPLv3

Author Information

Glauber Batista

Informazioni sul progetto

Ansible role to manage logrotate config files

Installa
ansible-galaxy install jobscore.logrotate
Licenza
gpl-3.0
Download
6k
Proprietario