Add borg
This commit is contained in:
parent
31744304a1
commit
18ef613556
7 changed files with 33 additions and 0 deletions
|
@ -4,6 +4,7 @@ server:
|
||||||
domain: mrdev023.fr
|
domain: mrdev023.fr
|
||||||
ssh_port: 7943
|
ssh_port: 7943
|
||||||
work_dir: /mnt/work
|
work_dir: /mnt/work
|
||||||
|
backup_dir: /mnt/backup
|
||||||
acme:
|
acme:
|
||||||
email: florian.richer.97@outlook.com
|
email: florian.richer.97@outlook.com
|
||||||
debug: true
|
debug: true
|
||||||
|
|
|
@ -4,6 +4,7 @@ server:
|
||||||
domain: mrdev023.test
|
domain: mrdev023.test
|
||||||
ssh_port: 22
|
ssh_port: 22
|
||||||
work_dir: /mnt/test
|
work_dir: /mnt/test
|
||||||
|
backup_dir: /mnt/btest
|
||||||
acme:
|
acme:
|
||||||
email: test@test.fr
|
email: test@test.fr
|
||||||
debug: true
|
debug: true
|
||||||
|
|
|
@ -13,4 +13,5 @@
|
||||||
- { role: n8n, tags: ["n8n"] }
|
- { role: n8n, tags: ["n8n"] }
|
||||||
- { role: matrix, tags: ["matrix"] }
|
- { role: matrix, tags: ["matrix"] }
|
||||||
- { role: iptables, tags: ["iptables"] }
|
- { role: iptables, tags: ["iptables"] }
|
||||||
|
- { role: borg, tags: ["borg"] }
|
||||||
- { role: clean, tags: ["clean"] }
|
- { role: clean, tags: ["clean"] }
|
||||||
|
|
13
roles/borg/tasks/base.yml
Normal file
13
roles/borg/tasks/base.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Copy template conf
|
||||||
|
ansible.builtin.template:
|
||||||
|
backup: true
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "/usr/bin/{{ item.dest }}"
|
||||||
|
group: root
|
||||||
|
owner: root
|
||||||
|
mode: u=rwx,g=rx,o=rx
|
||||||
|
loop:
|
||||||
|
- { src: 'backup.j2', dest: 'backup' }
|
||||||
|
become: true
|
8
roles/borg/tasks/cron.yml
Normal file
8
roles/borg/tasks/cron.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure a job that run to backup data
|
||||||
|
ansible.builtin.cron:
|
||||||
|
name: "borg backup"
|
||||||
|
special_time: "daily"
|
||||||
|
job: "/usr/bin/backup"
|
||||||
|
become: yes
|
7
roles/borg/tasks/main.yml
Normal file
7
roles/borg/tasks/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: base.yml
|
||||||
|
name: base
|
||||||
|
|
||||||
|
- ansible.builtin.import_tasks: cron.yml
|
||||||
|
name: cron
|
2
roles/borg/templates/backup.j2
Normal file
2
roles/borg/templates/backup.j2
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cd {{ server.work_dir }} && borg create --stats -C zstd,22 --progress "{{ server.backup_dir }}::$(date --iso-8601=seconds)" .
|
Loading…
Reference in a new issue