ansible-edda/playbooks/roles/backups/restic/setup/tasks/main.yml

48 lines
1.2 KiB
YAML

---
- name: "install restic"
ansible.builtin.apt:
name: "restic"
- name: "create a cache directory for restic"
ansible.builtin.file:
path: "/var/cache/restic"
state: "directory"
mode: 0755
- name: "create resic-batch config directory"
ansible.builtin.file:
path: "{{ system_etc_root_directory }}/restic-batch.d"
state: "directory"
mode: 0755
- name: "install restic-batch dependencies"
ansible.builtin.apt:
name: "python3-yaml"
- name: "install the restic-batch script"
ansible.builtin.copy:
src: "./restic-batch"
dest: "/usr/local/sbin/restic-batch"
mode: 0755
- name: "install the restic-batch service"
ansible.builtin.template:
src: "./restic-batch.service"
dest: "/etc/systemd/system/restic-batch.service"
mode: 0644
register: backups_restic_restic_batch_service_file
- name: "install the restic-batch timer"
ansible.builtin.copy:
src: "./restic-batch.timer"
dest: "/etc/systemd/system/restic-batch.timer"
mode: 0644
register: backups_restic_restic_batch_timer_file
- name: "systemd daemon reload"
ansible.builtin.systemd:
daemon_reload: true
when:
backups_restic_restic_batch_service_file.changed or
backups_restic_restic_batch_timer_file.changed