restic version from pillar

This commit is contained in:
Keiran Snowden
2023-11-27 19:51:17 -05:00
parent 1f89c93f30
commit 99efec7e95
3 changed files with 5 additions and 10 deletions

View File

@@ -1,12 +1,8 @@
#!/bin/bash
{% set arch = 'arm' salt.grains.get(cpuarch).startswith('arm') else 'amd64' %}
{% set restic_version = salt.pillar.get("restic:version") %}
if test -z "$RESTIC_VERSION"; then
echo "RESTIC_VERSION is not defined"
exit 1
fi
URL="https://github.com/restic/restic/releases/download/v${RESTIC_VERSION}/restic_${RESTIC_VERSION}_linux_{{ arch }}.bz2"
URL="https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_{{ arch }}.bz2"
wget --quiet "${URL}" -O - | bzip2 -cd > /bin/restic.tmp
if [ $? -eq 0 ]; then

View File

@@ -26,9 +26,7 @@ restic-{{ name }}:
- shell: /bin/bash
- source: 'salt://restic/files/install.sh'
- template: jinja
- unless: "/bin/restic version | grep 'restic 0.16.2 '"
- env:
- RESTIC_VERSION: 0.16.2
- unless: "/bin/restic version | grep 'restic {{ salt.pillar.get("restic:version") }} '"
{% endif %}
/etc/logrotate.d/restic-backup:

View File

@@ -3,7 +3,8 @@
- salt
- common
- users
{% if salt.pillar.get('restic', None) is not none %}
{% if salt.pillar.get('restic:client', None) is not none or
if salt.pillar.get('restic:server', None) is not none %}
- restic
{% endif %}
'*.keiran.us':