feat: add restic role and pb

This commit is contained in:
VC
2024-07-05 11:53:32 +02:00
parent 3d853e2d33
commit 02ee407244
7 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
---
- name: download restic
get_url:
url: "{{ restic_download_url }}"
dest: "/tmp"
- name: uncompress restic
shell:
cmd: "bzip2 -dc /tmp/restic_{{ restic_version }}_{{ restic_system }}_{{ restic_architecture }}.bz2 > {{ restic_path }}"
- name: check restic exe
file:
path: "{{ restic_path }}"
mode: 0755
owner: root
group: root

View File

@@ -0,0 +1,33 @@
---
## TEMP
- name: remove borg
include_tasks: remove_borg.yml
- name: install restic
include_tasks: install.yml
- name: put backup script
template:
src: resticbackup.sh.j2
dest: "{{ restic_script_path }}"
owner: root
group: root
mode: '0750'
- name: cron the backup script
cron:
name: "restic backup script"
hour: "{{ restic_backup_hour }}"
minute: "{{ restic_backup_minute }}"
job: "{{ restic_script_path }}"
- name: init restic
shell:
cmd: "restic init && restic stats"
creates: "/root/.cache/restic"
environment:
RESTIC_REPOSITORY: "{{ restic_repository }}"
RESTIC_PASSWORD: "{{ restic_pass }}"
AWS_ACCESS_KEY_ID: "{{ restic_aws_access_key_id }}"
AWS_SECRET_ACCESS_KEY: "{{ restic_aws_secret_access_key }}"

View File

@@ -0,0 +1,24 @@
---
- name: remove borg packet
package:
name: borgbackup
state: absent
- name: remove borg script
file:
path: /usr/local/bin/borgbackup.sh
state: absent
- name: remove cache dirs
file:
path: "{{ item }}"
state: absent
loop:
- "/root/.cache/borg"
- "/root/.config/borg"
- name: remove cron
cron:
name: "borg backup script"
state: absent