2021-05-08 14:23:21 +01:00
|
|
|
- name: Install restic
|
|
|
|
package:
|
|
|
|
name: restic
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Make user
|
|
|
|
user:
|
|
|
|
name: restic
|
|
|
|
shell: /bin/nologin
|
|
|
|
system: false
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: backrest
|
|
|
|
template:
|
|
|
|
src: files/backrest.sh
|
|
|
|
dest: /home/restic/backrest.sh
|
|
|
|
mode: "0700"
|
|
|
|
owner: restic
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Set restic binary permissions
|
|
|
|
file:
|
|
|
|
path: /usr/bin/restic
|
|
|
|
mode: "0750"
|
|
|
|
owner: root
|
|
|
|
group: restic
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Set cap_sys_chroot=+ep on restic
|
|
|
|
community.general.capabilities:
|
|
|
|
path: /usr/bin/restic
|
|
|
|
capability: cap_dac_read_search=+ep
|
|
|
|
become: true
|
2021-05-16 15:34:37 +01:00
|
|
|
|
|
|
|
- name: Schedule backup
|
|
|
|
cron:
|
|
|
|
name: restic backup
|
2021-05-23 20:37:41 +01:00
|
|
|
hour: 2
|
|
|
|
minute: 0
|
2021-05-16 15:34:37 +01:00
|
|
|
job: /home/restic/backrest.sh cron_backup
|
|
|
|
user: restic
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Schedule forget
|
|
|
|
cron:
|
|
|
|
name: restic forget
|
2021-05-23 20:37:41 +01:00
|
|
|
hour: 5
|
|
|
|
minute: 0
|
|
|
|
weekday: 0
|
2021-05-16 15:34:37 +01:00
|
|
|
job: /home/restic/backrest.sh cron_forget
|
|
|
|
user: restic
|
|
|
|
become: true
|
|
|
|
when: restic_forget
|
2021-06-27 10:58:01 +01:00
|
|
|
|
|
|
|
- name: backrest fail2ban config
|
|
|
|
template:
|
|
|
|
src: files/backrest-logrotate
|
|
|
|
dest: /etc/logrotate.d/backrest
|
|
|
|
mode: "0600"
|
|
|
|
become: true
|
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"
|
|
|
|
become: true
|
|
|
|
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"
|
|
|
|
become: true
|
|
|
|
when: ansible_os_family == 'Archlinux'
|