Ansible/playbooks/install_borgbackup.yml

33 lines
838 B
YAML
Raw Normal View History

---
- hosts: all
become: yes
vars:
2024-02-10 11:25:20 +00:00
borg_repo_path: "/var/backup/backup.borg/"
borg_repo_encryption: "none"
borg_backup_paths: "/etc/ /var/spool/ --exclude=*.log"
tasks:
- name: "Install borg backup"
apt:
name: borgbackup
state: latest
- name: "Create backup repository"
2024-02-10 11:25:20 +00:00
ansible.builtin.command: borg init -e {{borg_repo_encryption}} {{borg_repo_path}}
args:
2024-02-10 11:25:20 +00:00
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"