Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darkwizard242/ansible-role-logrotate
Ansible role for Logrotate. Available on Ansible Galaxy.
https://github.com/darkwizard242/ansible-role-logrotate
ansible ansible-galaxy ansible-role linux logrotate logrotate-utility system
Last synced: 22 days ago
JSON representation
Ansible role for Logrotate. Available on Ansible Galaxy.
- Host: GitHub
- URL: https://github.com/darkwizard242/ansible-role-logrotate
- Owner: darkwizard242
- License: mit
- Created: 2020-03-31T16:50:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-26T22:01:59.000Z (5 months ago)
- Last Synced: 2024-10-07T02:41:54.064Z (about 1 month ago)
- Topics: ansible, ansible-galaxy, ansible-role, linux, logrotate, logrotate-utility, system
- Language: Python
- Homepage: https://galaxy.ansible.com/darkwizard242/logrotate
- Size: 32.2 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![build-test](https://github.com/darkwizard242/ansible-role-logrotate/workflows/build-and-test/badge.svg?branch=master)](https://github.com/darkwizard242/ansible-role-logrotate/actions?query=workflow%3Abuild-and-test) [![release](https://github.com/darkwizard242/ansible-role-logrotate/workflows/release/badge.svg)](https://github.com/darkwizard242/ansible-role-logrotate/actions?query=workflow%3Arelease) ![Ansible Role](https://img.shields.io/ansible/role/d/darkwizard242/logrotate) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=ansible-role-logrotate&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=ansible-role-logrotate) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=ansible-role-logrotate&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=ansible-role-logrotate) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=ansible-role-logrotate&metric=security_rating)](https://sonarcloud.io/dashboard?id=ansible-role-logrotate) ![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/darkwizard242/ansible-role-logrotate?label=release) ![GitHub repo size](https://img.shields.io/github/repo-size/darkwizard242/ansible-role-logrotate?color=orange&style=flat-square)
# Ansible Role: logrotate
Role to install (_by default_) [logrotate](https://github.com/logrotate/logrotate) package or uninstall (_if passed as var_) as well as configure for any number of logrotate configurations on **Debian** based and **EL** based systems.
## Requirements
None.
## Role Variables
Available variables are listed below (located in `defaults/main.yml`):
### Variables list:
```yaml
logrotate_app: logrotate
logrotate_desired_state: present
logrotate_config_dir: /etc/logrotate.d
logrotate_configs: []
logrotate_template: conf.j2
```### Variables table:
Variable | Description
----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------
logrotate_app | Defines the app to install i.e. **logrotate**
logrotate_desired_state | Defined to dynamically chose whether to install (i.e. either `present` or `latest`) or uninstall (i.e. `absent`) the package. Defaults to `present`.
logrotate_config_dir | Directory to place logrotate configuration into i.e. **/etc/logrotate.d**
logrotate_configs | Pass desired logrotate configurations. Playbook example provided.
logrotate_template | Template used as source.## Dependencies
None
## Example Playbook
For default behaviour of role (i.e. installation of **logrotate** package) in ansible playbooks.
```yaml
- hosts: servers
roles:
- darkwizard242.logrotate
```For customizing behavior of role (i.e. custom config of **logrotate** ) in ansible playbooks.
```yaml
- hosts: servers
roles:
- darkwizard242.logrotate
vars:
logrotate_configs:
- name: ansible
path: /var/log/ansible.log
options:
- weekly
- create 0644 root root
- size 10M
- rotate 5
- dateext
- dateformat -%Y_%m_%d
- notifempty
- missingok
- compress
- delaycompress
- copytruncate
```For customizing behavior of role (i.e. custom config and postrotate scripts of **logrotate** ) in ansible playbooks.
```yaml
- hosts: servers
roles:
- darkwizard242.logrotate
vars:
logrotate_configs:
- name: ansible
path: /var/log/ansible.log
options:
- weekly
- create 0644 root root
- size 10M
- rotate 5
- dateext
- dateformat -%Y_%m_%d
- notifempty
- missingok
- compress
- delaycompress
- copytruncate- name: ansible-script
path: /var/log/ansible.log
options:
- weekly
- create 0644 root root
- size 10M
- rotate 5
- dateext
- dateformat -%Y_%m_%d
- notifempty
- missingok
- compress
- delaycompress
- copytruncate
scripts:
postrotate: 'echo "Ansible log has been rotated" > ~/rotation.txt'
```## License
[MIT](https://github.com/darkwizard242/ansible-role-logrotate/blob/master/LICENSE)
## Author Information
This role was created by [Ali Muhammad](https://www.alimuhammad.dev/).