Git Product home page Git Product logo

ansible-logrotate's Introduction

Ansible Role: logrotate

Installs logrotate and provides an easy way to setup additional logrotate scripts by specifying a list of directives.


Further development of this Ansible role has been moved to Collection bodsch.core. This repository will therefore no longer be actively maintained.


GitHub Workflow Status GitHub issues GitHub release (latest by date) Ansible Quality Score

Requirements & Dependencies

Ansible Collections

ansible-galaxy collection install bodsch.core

or

ansible-galaxy collection install --requirements-file collections.yml

Operating systems

Tested on

  • ArchLinux
  • Debian based
    • Debian 10 / 11 / 12
    • Ubuntu 20.04 / 22.04

RedHat-based systems are no longer officially supported! May work, but does not have to.

usage

logrotate_global:
  rotate_log: weekly
  rotate_size: ''
  su_user: ''
  su_group: ''
  rotate: 2
  create: true
  dateext: true
  compress: true
  tabooext: []
  archive_directory: ''

logrotate_conf_dir: "/etc/logrotate.d"

logrotate_scripts: {}

logroate_disable_systemd: true

logrotate_scripts: A dictionary of logrotate scripts and the directives to use for the rotation.

  • state - create (present) or remove (absent) configuration. default: present
  • path - Path to point logrotate to for the log rotation
  • paths - A list of paths to point logrotate to for the log rotation.
  • options - List of directives for logrotate, view the logrotate man page for specifics
  • scripts - Dict of scripts for logrotate (see Example below)
logrotate_scripts:
  audit:
    path: /var/log/audit/audit.log
    description: |
      rotate all audit logs
    options:
      - weekly
      - rotate 4
      - missingok
      - notifempty
      - delaycompress
    scripts:
      prerotate: systemctl stop auditd.service > /dev/null
      postrotate: systemctl start auditd.service > /dev/null
      foo: failed
logrotate_scripts:
  nginx:
    paths:
      - /var/log/nginx/*/*.log
      - /var/log/nginx/*.log
    options:
      - weekly
      - rotate 2
      - missingok
      - notifempty
      - compress
      - sharedscripts
      - create 0644 http log
      - su root http
    scripts:
      postrotate: test ! -r /run/nginx.pid || kill -USR1 $(cat /run/nginx.pid)

Example Playbook

see into molecule test and configuration

Contribution

Please read Contribution

Development, Branches (Git Tags)

The master Branch is my Working Horse includes the "latest, hot shit" and can be complete broken!

If you want to use something stable, please use a Tagged Version!

Author

  • Bodo Schulz

License

Apache

FREE SOFTWARE, HELL YEAH!

ansible-logrotate's People

Contributors

bodsch avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.