Fix template extension, add borg backup install

This commit is contained in:
2024-02-10 12:09:14 +01:00
parent f0f9df53a3
commit 9691d7dc5d
3 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,31 @@
---
- hosts: all
become: yes
vars:
borg.repo.path: /var/backup/backup.borg/
borg.repo.encryption: none
tasks:
- name: "Install borg backup"
apt:
name: borgbackup
state: latest
- name: "Create backup repository"
ansible.builtin.command: borg init -e {{borg.repo.encryption}} {{borg.repo.path}}
args:
creates: {{borg.repo.path}}
- name: "Configure backup script"
ansible.builtin.copy:
src: ../templates/borgbackup.j2
dest: /opt/borgbackup.sh
owner: root
group: root
mode: '744'
- name: "Configure cronjob"
ansible.builtin.cron:
name: "Borg backup"
minute: "0"
hour: "1"
job: "/opt/borgbackup.sh"