Skip to content
Snippets Groups Projects
Commit 85b1a98b authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Add rsnapshot role

parent fc212dee
No related branches found
No related tags found
No related merge requests found
---
rsnapshot_enable_frequently: true
#!/bin/sh
for file in /etc/rsnapshot.d/*.conf; do
echo "include_conf $file"
done
---
- name: install rsnapshot
apt:
name: rsnapshot
state: present
- name: create drop-in directory for backup config
file:
path: /etc/rsnapshot.d
state: directory
owner: root
group: root
mode: '0755'
- name: create script for rsnapshot's crazy include_conf to work
copy:
src: "list-rsnapshot-config-files.sh"
dest: "/usr/local/bin"
owner: root
group: root
mode: '0755'
- name: configure rsnapshot
template:
src: rsnapshot.conf.j2
dest: /etc/rsnapshot.conf
owner: root
group: root
mode: '0644'
- name: make rsnapshot run regularly
template:
src: crontab.j2
dest: /etc/cron.d/rsnapshot
owner: root
group: root
mode: '0644'
{% if rsnapshot_enable_frequently %}
5,20,35,50 * * * * root /usr/bin/rsnapshot -c /etc/rsnapshot.conf frequently
{% endif %}
3 * * * * root /usr/bin/rsnapshot -c /etc/rsnapshot.conf hourly
51 23 * * * root /usr/bin/rsnapshot -c /etc/rsnapshot.conf daily
41 23 * * 6 root /usr/bin/rsnapshot -c /etc/rsnapshot.conf weekly
31 23 2 * * root /usr/bin/rsnapshot -c /etc/rsnapshot.conf monthly
config_version 1.2
snapshot_root /var/backups
include_conf `/usr/local/bin/list-rsnapshot-config-files.sh`
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_rsync /usr/bin/rsync
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
{% if rsnapshot_enable_frequently %}
retain frequently 4
{% endif %}
retain hourly 6
retain daily 7
retain weekly 4
retain monthly 6
verbose 2
loglevel 4
lockfile /run/rsnapshot.pid
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment