Ansible/playbooks/install_borgbackup.yml

32 lines
777 B
YAML
Raw Normal View History

---
- 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"