You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
858 B
YAML

- name: Check if we already installed borgmatic
stat:
path: "/etc/systemd/system/borgmatic@.service"
register: borgmatic_installed
- name: "Install borg and borgmatic"
include: install.yml
when: not borgmatic_installed.stat.exists
- name: "Template directory backup configuration files"
template:
src: directories.yaml
dest: /etc/borgmatic.d/directories.yaml
- name: "Template systemd nightly timer"
ansible.builtin.template:
src: "../templates/borgmatic-nightly@.timer"
dest: "/etc/systemd/system/borgmatic-nightly@.timer"
owner: root
group: root
mode: u=rw,g=r,o=r
- name: "Enable nightly backup timer"
systemd:
name: borgmatic-nightly@directories.timer
enabled: yes
state: started
# TODO: generate SSH keys and ssh_config on host, authorized_keys on target
# TODO: initialise repository