get restic path from environment

This commit is contained in:
Ryan Cavicchioni 2020-04-20 22:28:32 -05:00
parent e08ed9a2ec
commit b2f56598fa
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D
5 changed files with 24 additions and 3 deletions

View File

@ -8,7 +8,9 @@ error_exit() {
} }
RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic} RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
RESTIC_PATH=${RESTIC_PATH:-/usr/local/bin/restic}
# shellcheck source=/dev/null
source "${RESTIC_ETC_PATH}/env.sh"
MAX_ATTEMPTS=60 MAX_ATTEMPTS=60
NICE="ionice -c2 nice -n19" NICE="ionice -c2 nice -n19"

View File

@ -8,7 +8,9 @@ error_exit() {
} }
RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic} RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
RESTIC_PATH=${RESTIC_PATH:-/usr/local/bin/restic}
# shellcheck source=/dev/null
source "${RESTIC_ETC_PATH}/env.sh"
if [ $# -lt 2 ]; then if [ $# -lt 2 ]; then
error_exit "missing arguments" error_exit "missing arguments"

View File

@ -8,7 +8,9 @@ error_exit() {
} }
RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic} RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
RESTIC_PATH=${RESTIC_PATH:-/usr/local/bin/restic}
# shellcheck source=/dev/null
source "${RESTIC_ETC_PATH}/env.sh"
if [ "$RESTIC_SELF_UPDATE" -eq 1 ]; then if [ "$RESTIC_SELF_UPDATE" -eq 1 ]; then
printf "running restic self-update\n" printf "running restic self-update\n"

View File

@ -65,6 +65,14 @@
- "{{ restic_etc_path }}/repos" - "{{ restic_etc_path }}/repos"
- "{{ restic_etc_path }}/jobs" - "{{ restic_etc_path }}/jobs"
- name: create environment helper
template:
src: env.sh.j2
dest: "{{ restic_etc_path }}/env.sh"
owner: root
group: root
mode: 0400
- name: copy restic helper scripts - name: copy restic helper scripts
copy: copy:
src: "{{ item }}" src: "{{ item }}"

View File

@ -0,0 +1,7 @@
#!/bin/bash
# {{ ansible_managed }}
RESTIC_ETC_PATH="{{ restic_etc_path | default('/etc/restic') }}"
RESTIC_PATH="{{ restic_path | default('/usr/local/bin/restic') }}"
RESTIC_SELF_UPDATE={{ restic_self_update | ternary(1, 0) }}