Extract restic repo init to shared task file
Deduplicate nearly identical init logic from backend.yml and backend_sftp.yml into init.yml. Also fixes missing set -euo pipefail in the sftp backend variant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
16da843131
commit
796428cbda
3 changed files with 11 additions and 15 deletions
|
|
@ -8,12 +8,5 @@
|
|||
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
|
||||
- ansible.builtin.include_tasks: init.yml
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue