2021-05-08 14:23:21 +01:00
|
|
|
- name: Install restic
|
|
|
|
package:
|
|
|
|
name: restic
|
|
|
|
|
2024-01-03 21:09:07 +00:00
|
|
|
- name: Install runitor
|
|
|
|
kewlfft.aur.aur:
|
|
|
|
name: runitor-bin
|
|
|
|
|
2021-05-08 14:23:21 +01:00
|
|
|
- name: Make user
|
|
|
|
user:
|
|
|
|
name: restic
|
|
|
|
shell: /bin/nologin
|
|
|
|
system: false
|
|
|
|
|
2024-01-03 21:09:07 +00:00
|
|
|
- name: Install scripts
|
2021-05-08 14:23:21 +01:00
|
|
|
template:
|
2024-01-03 21:09:07 +00:00
|
|
|
src: files/{{ item }}
|
|
|
|
dest: /home/restic/{{ item }}
|
2021-05-08 14:23:21 +01:00
|
|
|
mode: "0700"
|
|
|
|
owner: restic
|
2024-01-03 21:09:07 +00:00
|
|
|
loop:
|
|
|
|
- backrest.sh
|
|
|
|
- restic-backup.sh
|
2021-05-08 14:23:21 +01:00
|
|
|
|
2021-08-30 21:49:58 +01:00
|
|
|
- name: Install includes files
|
|
|
|
copy:
|
|
|
|
content: "{{ restic_backup_locations | join('\n') }}"
|
|
|
|
dest: /home/restic/restic-include.txt
|
|
|
|
mode: "0644"
|
|
|
|
owner: restic
|
|
|
|
|
|
|
|
- name: Install excludes files
|
|
|
|
copy:
|
|
|
|
content: "{{ restic_backup_excludes | join('\n') }}"
|
|
|
|
dest: /home/restic/restic-excludes.txt
|
|
|
|
mode: "0644"
|
|
|
|
owner: restic
|
|
|
|
|
2021-05-08 14:23:21 +01:00
|
|
|
- name: Set restic binary permissions
|
|
|
|
file:
|
|
|
|
path: /usr/bin/restic
|
|
|
|
mode: "0750"
|
|
|
|
owner: root
|
|
|
|
group: restic
|
|
|
|
|
|
|
|
- name: Set cap_sys_chroot=+ep on restic
|
|
|
|
community.general.capabilities:
|
|
|
|
path: /usr/bin/restic
|
|
|
|
capability: cap_dac_read_search=+ep
|
2021-05-16 15:34:37 +01:00
|
|
|
|
|
|
|
- name: Schedule backup
|
|
|
|
cron:
|
|
|
|
name: restic backup
|
2022-11-20 22:52:00 +00:00
|
|
|
hour: 0
|
2021-05-23 20:37:41 +01:00
|
|
|
minute: 0
|
2024-01-03 21:09:07 +00:00
|
|
|
job: CHECK_UUID={{ vault_restic_healthchecks_id }} /usr/bin/runitor -- /home/restic/restic-backup.sh
|
2021-05-16 15:34:37 +01:00
|
|
|
user: restic
|
|
|
|
|
2021-08-10 08:45:59 +01:00
|
|
|
- name: Install pacman post script
|
|
|
|
template:
|
|
|
|
src: files/restic-post.sh
|
|
|
|
dest: /usr/share/libalpm/scripts/restic-post.sh
|
|
|
|
mode: "0700"
|
|
|
|
when: ansible_os_family == 'Archlinux'
|
|
|
|
|
|
|
|
- name: Install pacman post hook
|
|
|
|
template:
|
|
|
|
src: files/restic-post.hook
|
|
|
|
dest: /usr/share/libalpm/hooks/restic-post.hook
|
|
|
|
mode: "0600"
|
|
|
|
when: ansible_os_family == 'Archlinux'
|
2021-11-21 21:53:35 +00:00
|
|
|
|
|
|
|
- name: Install HomeAssistant mounts
|
|
|
|
include_tasks: homeassistant.yml
|
|
|
|
when: ansible_hostname == 'pve-restic'
|