39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
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 public key
|
|
copy:
|
|
src: "{{ role_path }}/files/id_ed25519.pub"
|
|
dest: "{{ service_dir }}/id_ed25519.pub"
|
|
mode: 0644
|
|
- 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' }}"
|