SimpliField.file-retention
File Retention
This is an Ansible role designed to delete the oldest files or paths in a specified location.
Requirements
You need Ansible version 2 or higher, and Cron must be available on the target host.
Role Variables
file-retention_path = '/data/db/backups' # The path where files will be managed
file-retention_days = 30 # How many days' worth of files to keep
file-retention_user = 'www' # The user under which the command will run
Dependencies
There are no additional dependencies for this role.
Example Playbook
Here’s how you can use this role in a playbook:
- hosts: servers
roles:
- role: SimpliField.file-retention
file-retention_path: '/data/db/backups' # Path to manage files
file-retention_days: 30 # Days of files to retain
file-retention_user: 'www' # User for running the role
License
This project is licensed under the BSD license.