Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xtrinch/ansible-role-backup-file
Regularly create local backup of file in filesystem
https://github.com/xtrinch/ansible-role-backup-file
Last synced: 12 days ago
JSON representation
Regularly create local backup of file in filesystem
- Host: GitHub
- URL: https://github.com/xtrinch/ansible-role-backup-file
- Owner: xtrinch
- License: mit
- Created: 2017-12-28T13:40:29.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-29T07:47:14.000Z (about 7 years ago)
- Last Synced: 2024-11-11T11:06:55.601Z (about 2 months ago)
- Homepage:
- Size: 31.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Ansible Role](https://img.shields.io/ansible/role/23033.svg)](https://galaxy.ansible.com/xtrinch/backup-file/)
[![Build Status](https://travis-ci.org/xtrinch/ansible-role-backup-file.svg?branch=master)](https://travis-ci.org/xtrinch/ansible-role-backup-file)Role Name
=========Create entry in user crontab for backuping a file every n minutes defined with role variables `directory` and `filename` to directory defined with `backup_directory` with timeframe defined with `backup_minutes`, and deleting entries older than `delete_backup_days` days
Role Variables
--------------Should be overridden:
directory: "/home/{{ ansible_ssh_user}}"
filename: "backMeUp.test"
backup_directory: "/home/{{ansible_ssh_user}}/backups"
Only override if necessary:backup_minutes: 5
delete_backup_days: 7
cronjob_backup: '*/{{ backup_minutes }} * * * * cp {{ directory }}/{{ filename }} {{ backup_directory }}/{{ filename }}`date +\%d\%m\%y\%H\%M`.bak > /dev/null'
cronjob_delete_old: '*/{{ backup_minutes }} * * * * find /home/{{ ansible_ssh_user }}/backups -mtime +{{ delete_backup_days }} -exec rm -f {} \;'Example Playbook
----------------- hosts: servers
roles:
- { role: xtrinch.backup-file,
directory: "/home/{{ ansible_ssh_user}}",
filename: "backMeUp.test",
backup_directory: "/home/{{ansible_ssh_user}}/backups" }License
-------MIT