Skip to content

Instantly share code, notes, and snippets.

@ubergesundheit
Last active January 3, 2021 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ubergesundheit/49abb8a6824b8f82dd1b301ba1161506 to your computer and use it in GitHub Desktop.
Save ubergesundheit/49abb8a6824b8f82dd1b301ba1161506 to your computer and use it in GitHub Desktop.
ansible install restic tasks (for debian & ubuntu)
---
# requires the variable `restic_version` (only tested with `0.11.0`)
- name: Install installation requirements
apt:
name:
- gnupg
state: present
update_cache: yes
- name: Download checksum files
get_url:
url: "https://github.com/restic/restic/releases/download/v{{ restic_version }}/{{ item }}"
dest: "/tmp/{{ item }}"
mode: "0644"
loop:
- "SHA256SUMS"
- "SHA256SUMS.asc"
- name: Download restic binary
get_url:
url: "https://github.com/restic/restic/releases/download/v{{ restic_version }}/restic_{{ restic_version }}_linux_amd64.bz2"
dest: "/tmp/restic_{{ restic_version }}_linux_amd64.bz2"
mode: "0644"
register: restic_archive
- name: Unarchive restic
when: restic_archive.changed
shell: |
set -ex
cd /tmp
gpg --keyserver pool.sks-keyservers.net --recv-keys {{ restic_signkey_id }}
gpg --verify SHA256SUMS.asc SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS
bzip2 -dc /tmp/restic_{{ restic_version }}_linux_amd64.bz2 > /usr/local/bin/restic
chmod +x /usr/local/bin/restic
/usr/local/bin/restic version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment