ansible-edda/playbooks/tasks/backups/01-restic-setup.yml

41 lines
973 B
YAML
Raw Normal View History

2022-10-14 21:32:51 +02:00
- name: Check if restic is insalled
stat:
path: /usr/local/bin/restic
register: restic_path
- block:
- name: Download restic binary
get_url:
url: https://github.com/restic/restic/releases/download/v0.14.0/restic_0.14.0_linux_amd64.bz2
dest: /usr/local/bin/restic.bz2
mode: 0644
- name: Unpack restic binary
command: bunzip2 /usr/local/bin/restic.bz2
when:
not restic_path.stat.exists
- name: Ensure restic is executable
file:
path: /usr/local/bin/restic
mode: 0755
- name: Create scaleway key file
template:
src: ./filesystem/{{ ansible_hostname }}/etc/scaleway.keys.j2
dest: /etc/scaleway.keys
mode: 0600
- name: Create restic password file
template:
src: ./filesystem/{{ ansible_hostname }}/etc/restic.password.j2
dest: /etc/restic.password
mode: 0600
- name: Create a cache directory for restic
file:
path: /var/cache/restic
state: directory
mode: 0755