Compare commits
1 Commits
4a7cd07ac9
...
768aecc9a4
Author | SHA1 | Date | |
---|---|---|---|
768aecc9a4 |
@ -11,16 +11,5 @@ restic_bin_path: /usr/local/bin
|
|||||||
restic_etc_path: /etc/restic
|
restic_etc_path: /etc/restic
|
||||||
restic_path: "{{ restic_bin_path }}/restic"
|
restic_path: "{{ restic_bin_path }}/restic"
|
||||||
|
|
||||||
restic_global_exclude:
|
|
||||||
- /dev
|
|
||||||
- /media
|
|
||||||
- /mnt
|
|
||||||
- /proc
|
|
||||||
- /run
|
|
||||||
- /sys
|
|
||||||
- /tmp
|
|
||||||
- /var/tmp
|
|
||||||
- /var/lib/lxcfs/cgroup
|
|
||||||
|
|
||||||
restic_repos: []
|
restic_repos: []
|
||||||
restic_jobs: []
|
restic_jobs: []
|
||||||
|
@ -7,14 +7,6 @@
|
|||||||
mode: 0755
|
mode: 0755
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: create repo environment helper
|
|
||||||
template:
|
|
||||||
src: job-env.sh.j2
|
|
||||||
dest: "{{ restic_etc_path }}/jobs/{{ item.name }}/env.sh"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0400
|
|
||||||
|
|
||||||
- name: create job exclude file
|
- name: create job exclude file
|
||||||
template:
|
template:
|
||||||
src: exclude.txt.j2
|
src: exclude.txt.j2
|
||||||
@ -27,10 +19,10 @@
|
|||||||
cron:
|
cron:
|
||||||
name: "restic {{ item.name }} job"
|
name: "restic {{ item.name }} job"
|
||||||
hour: "{{ item.cron.hour | default(omit) }}"
|
hour: "{{ item.cron.hour | default(omit) }}"
|
||||||
minute: "{{ item.cron.minute | default(60 | random(seed=inventory_hostname)) }}"
|
minute: "{{ item.cron.minute | default(omit) }}"
|
||||||
day: "{{ item.cron.day | default(omit) }}"
|
day: "{{ item.cron.day | default(omit) }}"
|
||||||
month: "{{ item.cron.month | default(omit) }}"
|
month: "{{ item.cron.month | default(omit) }}"
|
||||||
weekday: "{{ item.cron.weekday | default(omit) }}"
|
weekday: "{{ item.cron.weekday | default(omit) }}"
|
||||||
user: "{{ item.cron.user | default('root') }}"
|
user: "{{ item.cron.user | default('root') }}"
|
||||||
state: "{{ item.cron.state | default('present') }}"
|
state: "{{ item.cron.state | default('present') }}"
|
||||||
job: "{{ restic_bin_path }}/restic-job {{ item.name }}"
|
job: ". {{ restic_etc_path }}/repos/{{ item.repo }}/env.sh && restic backup -q --exclude-file {{ restic_etc_path }}/jobs/{{ item.name }}/exclude.txt {{ item.paths | join(' ') }}"
|
||||||
|
@ -65,22 +65,6 @@
|
|||||||
- "{{ restic_etc_path }}/repos"
|
- "{{ restic_etc_path }}/repos"
|
||||||
- "{{ restic_etc_path }}/jobs"
|
- "{{ restic_etc_path }}/jobs"
|
||||||
|
|
||||||
- name: create restic job wrapper script
|
|
||||||
template:
|
|
||||||
src: restic-job.sh.j2
|
|
||||||
dest: "{{ restic_bin_path }}/restic-job"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: create restic tidy wrapper
|
|
||||||
template:
|
|
||||||
src: restic-tidy.sh.j2
|
|
||||||
dest: "{{ restic_bin_path }}/restic-tidy"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0755
|
|
||||||
|
|
||||||
- name: manage repos
|
- name: manage repos
|
||||||
include: repo.yaml
|
include: repo.yaml
|
||||||
loop: "{{ restic_repos | default([]) }}"
|
loop: "{{ restic_repos | default([]) }}"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: get repo status
|
- name: get repo status
|
||||||
shell:
|
shell:
|
||||||
cmd: restic -q -r {{ item.repo }} --no-lock snapshots 2> /dev/null
|
cmd: restic -q -r {{ item.repo }} snapshots 2> /dev/null
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
environment: "{{ item.environment | default({}) }}"
|
environment: "{{ item.environment | default({}) }}"
|
||||||
register: restic_init
|
register: restic_init
|
||||||
@ -30,17 +30,8 @@
|
|||||||
|
|
||||||
- name: create repo environment helper
|
- name: create repo environment helper
|
||||||
template:
|
template:
|
||||||
src: repo-env.sh.j2
|
src: env.sh.j2
|
||||||
dest: "{{ restic_etc_path }}/repos/{{ item.name }}/env.sh"
|
dest: "{{ restic_etc_path }}/repos/{{ item.name }}/env.sh"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0400
|
mode: 0400
|
||||||
|
|
||||||
- name: create cron
|
|
||||||
cron:
|
|
||||||
name: "restic {{ item.name }} tidy"
|
|
||||||
hour: "0"
|
|
||||||
minute: "{{ 60 | random(seed=inventory_hostname) }}"
|
|
||||||
user: root
|
|
||||||
state: present
|
|
||||||
job: "{{ restic_bin_path }}/restic-tidy {{ item.name }}"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user