Skip to content

retr0h/ansible-logrotate

Repository files navigation

logrotate

A library which manages log rotate configurations.

Library ready status

Build Status Galaxy

Requirements

  • Ansible >= 2.2

Dependencies

None

Example Playbook

- hosts: servers
  tasks:
    - name: Rotate /var/log/tomcat/myapp.log
      logrotate: name=myapp
                 path=/var/log/tomcat/myapp.log
      args:
        options:
          - daily
          - rotate 8
          - postrotate
          - exec script
          - endscript

    - name: rotate /var/log/wibble.log
      logrotate:
        name: wibble-log
        path: '/var/log/wibble*.log'
        options:
          - daily
          - size +1M
          - rotate 7
          - missingok
          - copytruncate
          - compress

Testing

Tests are performed by Molecule.

$ tox

License

MIT