1
0

Add backups with gobackup and restic

This commit is contained in:
2025-05-02 17:34:31 +03:00
parent 132da79fab
commit a31cbbe18e
7 changed files with 204 additions and 78 deletions

48
playbook-backups.yml Normal file
View File

@ -0,0 +1,48 @@
---
- name: 'Configure restic and backup schedule'
hosts: all
vars_files:
- vars/vars.yml
- vars/secrets.yml
tasks:
- name: 'Copy restic shell script'
ansible.builtin.template:
src: "files/backups/restic-shell.sh.j2"
dest: "{{ bin_prefix }}/restic-shell.sh"
owner: root
group: root
mode: "0700"
- name: 'Copy restic backup script'
ansible.builtin.template:
src: "files/backups/restic-backup.sh.j2"
dest: "{{ bin_prefix }}/restic-backup.sh"
owner: root
group: root
mode: '0700'
- name: 'Create gobackup config directory'
ansible.builtin.file:
path: "{{ backup_gobackup_config | dirname }}"
state: directory
mode: '0755'
- name: 'Copy gobackup config files'
ansible.builtin.template:
src: "files/backups/gobackup.yml.j2"
dest: "{{ backup_gobackup_config }}"
owner: root
group: root
mode: '0700'
# - name: "Creates a cron file for backups under /etc/cron.d"
# ansible.builtin.cron:
# name: restic backup
# minute: "0"
# hour: "2"
# user: "root"
# job: "systemd-cat {{ bin_prefix }}/restic-backup.sh"
# cron_file: ansible_restic_backup