Add backups with gobackup and restic
This commit is contained in:
48
playbook-backups.yml
Normal file
48
playbook-backups.yml
Normal 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
|
Reference in New Issue
Block a user