salt-states/restic/files/restic.jinja

24 lines
700 B
Plaintext
Raw Normal View History

2023-06-27 07:16:37 +00:00
#!/bin/bash
if [[ "$EUID" -ne 0 ]]; then
echo "Needs to be run as root"
exit 1
fi
podman run --rm \
--name=restic \
--hostname="$HOSTNAME" \
-v /root/.restic.password:/restic-password:ro \
{%- if pillar.restic.repository is defined %}
-v {{ pillar.restic.mount }}{{ pillar.restic.suffix }}:/repo \
{%- endif %}
-v /root:/root \
{{ pillar.restic.image.url }}:{{ pillar.restic.image.tag }} \
restic \
--password-file=/restic-password \
{%- if pillar.restic.repository is defined %}
--repo=/repo \
{%- else %}
-r sftp:{{ pillar.restic.user }}@{{ pillar.restic.host }}:{{ pillar.restic.mount }}{{ pillar.restic.suffix }} \
{%- endif %}
"$@"