This repository has been archived on 2023-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
max/roles/borg/tasks/main.yml
2023-01-11 20:04:31 +01:00

34 lines
959 B
YAML

- name: Install borg
apt:
pkg:
- borgbackup
- borgmatic
- name: Create borg service directory
file:
path: "{{ service_dir }}"
state: directory
- name: Copy borg backup configuration
template:
src: "{{ role_path }}/templates/backup.yml.j2"
dest: "{{ service_dir }}/backup.yml"
- name: Copy private key
copy:
src: "{{ role_path }}/files/id_ed25519"
dest: "{{ service_dir }}/id_ed25519"
mode: 0600
- name: Copy systemd timer backup service
template:
src: "{{ role_path }}/templates/backup.service.j2"
dest: "/etc/systemd/system/backup.service"
register: service
- name: Copy systemd timer backup timer
copy:
src: "{{ role_path }}/files/backup.timer"
dest: "/etc/systemd/system/backup.timer"
register: timer
- name: Enable systemd timer
systemd:
name: backup.timer
enabled: true
state: started
daemon_reload: "{{ 'yes' if service.changed or timer.changed else 'no' }}"