20 lines
505 B
YAML
20 lines
505 B
YAML
|
|
---
|
||
|
|
- name: Ensure restic local repo directory exists
|
||
|
|
file:
|
||
|
|
path: "{{ restic_repo }}"
|
||
|
|
state: directory
|
||
|
|
owner: root
|
||
|
|
group: root
|
||
|
|
mode: "0700"
|
||
|
|
when: restic_repo is defined and restic_repo.startswith('/') # only local path
|
||
|
|
|
||
|
|
- name: Ensure restic repo is initialized
|
||
|
|
ansible.builtin.shell: |
|
||
|
|
set -euo pipefail
|
||
|
|
source /etc/restic/restic.env
|
||
|
|
restic snapshots > /dev/null 2>&1 || restic init
|
||
|
|
touch /etc/restic/.initialized
|
||
|
|
args:
|
||
|
|
creates: /etc/restic/.initialized
|
||
|
|
|