2021-08-24 21:52:28 +02:00
|
|
|
- name: "Try to update restic"
|
|
|
|
command: "restic self-update"
|
|
|
|
register: restic_update
|
|
|
|
ignore_errors: true
|
|
|
|
|
2021-08-23 14:54:10 +02:00
|
|
|
- name: "Download restic"
|
2021-08-23 14:34:24 +02:00
|
|
|
get_url:
|
|
|
|
url: "{{ restic_url }}"
|
|
|
|
dest: /tmp/restic.bz2
|
2021-08-24 21:52:28 +02:00
|
|
|
register: restic_download
|
|
|
|
when: restic_update is failed
|
2021-08-23 14:34:24 +02:00
|
|
|
|
2021-08-23 14:53:08 +02:00
|
|
|
- name: "Extract restic"
|
2021-08-23 15:07:58 +02:00
|
|
|
command: "bzip2 -df /tmp/restic.bz2"
|
2021-08-24 21:52:28 +02:00
|
|
|
register: restic_extract
|
|
|
|
when: restic_download is changed
|
2021-08-23 14:53:08 +02:00
|
|
|
|
|
|
|
- name: "Install restic"
|
|
|
|
copy:
|
2021-08-23 15:04:53 +02:00
|
|
|
src: "/tmp/restic"
|
2021-08-23 15:05:47 +02:00
|
|
|
dest: "/usr/bin/restic"
|
2021-08-23 14:29:27 +02:00
|
|
|
remote_src: yes
|
|
|
|
mode: "751"
|
2021-08-24 21:52:28 +02:00
|
|
|
when: restic_extract is changed
|
2021-08-23 15:19:18 +02:00
|
|
|
|
2021-11-15 16:52:27 +01:00
|
|
|
- name: "Copy the backup script"
|
|
|
|
template:
|
|
|
|
src: "backup-to-restic.j2"
|
2021-11-15 17:09:18 +01:00
|
|
|
dest: "/home/ansible/backup-to-restic"
|
2021-11-15 16:52:27 +01:00
|
|
|
directory_mode: yes
|
|
|
|
owner: "ansible"
|
|
|
|
group: "ansible"
|
|
|
|
mode: 0755
|
|
|
|
|
2021-08-23 15:23:39 +02:00
|
|
|
- name: "Create the restic config dir"
|
|
|
|
file:
|
|
|
|
path: "/etc/restic/"
|
|
|
|
state: directory
|
|
|
|
mode: "0755"
|
|
|
|
|
2021-08-23 15:19:18 +02:00
|
|
|
- name: "Copy excludes file"
|
|
|
|
copy:
|
|
|
|
src: "excludes.txt"
|
|
|
|
dest: "/etc/restic/excludes.txt"
|