restic version from pillar
This commit is contained in:
@@ -1,12 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
{% set arch = 'arm' salt.grains.get(cpuarch).startswith('arm') else 'amd64' %}
|
{% 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
|
URL="https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_{{ arch }}.bz2"
|
||||||
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"
|
|
||||||
|
|
||||||
wget --quiet "${URL}" -O - | bzip2 -cd > /bin/restic.tmp
|
wget --quiet "${URL}" -O - | bzip2 -cd > /bin/restic.tmp
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ restic-{{ name }}:
|
|||||||
- shell: /bin/bash
|
- shell: /bin/bash
|
||||||
- source: 'salt://restic/files/install.sh'
|
- source: 'salt://restic/files/install.sh'
|
||||||
- template: jinja
|
- template: jinja
|
||||||
- unless: "/bin/restic version | grep 'restic 0.16.2 '"
|
- unless: "/bin/restic version | grep 'restic {{ salt.pillar.get("restic:version") }} '"
|
||||||
- env:
|
|
||||||
- RESTIC_VERSION: 0.16.2
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
/etc/logrotate.d/restic-backup:
|
/etc/logrotate.d/restic-backup:
|
||||||
|
|||||||
3
top.sls
3
top.sls
@@ -3,7 +3,8 @@
|
|||||||
- salt
|
- salt
|
||||||
- common
|
- common
|
||||||
- users
|
- 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
|
- restic
|
||||||
{% endif %}
|
{% endif %}
|
||||||
'*.keiran.us':
|
'*.keiran.us':
|
||||||
|
|||||||
Reference in New Issue
Block a user