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

48 lines
1.2 KiB
YAML
Raw Normal View History

2022-12-18 23:43:40 +01:00
---
2023-10-01 19:26:59 +02:00
- name: "install restic"
ansible.builtin.apt:
name: "restic"
2022-12-18 17:06:27 +01:00
- 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:
2023-07-23 00:37:19 +02:00
path: "{{ system_etc_root_directory }}/restic-batch.d"
2022-12-18 17:06:27 +01:00
state: "directory"
mode: 0755
2023-02-13 00:12:30 +01:00
- name: "install restic-batch dependencies"
ansible.builtin.apt:
name: "python3-yaml"
2022-12-18 17:06:27 +01:00
- 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"
2023-07-23 00:37:19 +02:00
ansible.builtin.template:
2022-12-18 17:06:27 +01:00
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