2019-08-13 13:26:40 +02:00
|
|
|
---
|
|
|
|
- name: Set restic_url
|
|
|
|
set_fact:
|
2019-08-15 08:36:57 +02:00
|
|
|
restic_url_r: 'https://github.com/restic/restic/releases/download/'
|
|
|
|
arch: ansible_architecture
|
|
|
|
restic_platform: '{{ _platform_map[arch] | default(arch) }}'
|
|
|
|
restic_system: '{{ ansible_system | lower }}'
|
|
|
|
restic_url_v: 'v{{ restic_version }}/restic_{{ restic_version }}_'
|
|
|
|
restic_file: '{{ restic_system }}_{{ restic_platform }}.bz2'
|
|
|
|
restic_url: '{{ restic_url_r }}{{ restic_url_v }}{{ restic_file }}'
|
2019-08-15 09:59:53 +02:00
|
|
|
when: restic_url is not defined
|
2019-08-13 13:26:40 +02:00
|
|
|
|
|
|
|
- name: Download client binary
|
|
|
|
get_url:
|
|
|
|
url: '{{ restic_url }}'
|
|
|
|
dest: '{{ restic_download_path }}/restic.bz2'
|
2019-08-14 16:59:32 +02:00
|
|
|
force: true
|
2019-08-13 13:26:40 +02:00
|
|
|
register: get_url_restic
|
|
|
|
|
2019-08-13 13:29:21 +02:00
|
|
|
# TODO: This needs to become independent of the shell module to actually work
|
|
|
|
# on every system. We could use a distribution specific aproach, but this would
|
|
|
|
# conflict with the current structure in tasks/distribution/
|
2019-08-13 13:26:40 +02:00
|
|
|
- name: Decompress the binary
|
2019-08-15 08:36:57 +02:00
|
|
|
shell: "bzip2 -dc {{ get_url_restic.dest }} > {{ restic_bin_bath }}"
|
2019-08-13 13:26:40 +02:00
|
|
|
args:
|
|
|
|
creates: '{{ restic_download_path }}/bin/restic-{{ restic_version }}'
|
|
|
|
|
|
|
|
- name: Ensure permissions are correct
|
|
|
|
file:
|
|
|
|
path: '{{ restic_download_path }}/bin/restic-{{ restic_version }}'
|
|
|
|
mode: '0755'
|
|
|
|
owner: '{{ restic_dir_owner }}'
|
|
|
|
group: '{{ restic_dir_group }}'
|
|
|
|
|
|
|
|
- name: Create symbolic link to the correct version
|
|
|
|
file:
|
|
|
|
src: '{{ restic_download_path }}/bin/restic-{{ restic_version }}'
|
|
|
|
path: '{{ restic_install_path }}/restic'
|
|
|
|
state: link
|
2019-08-14 16:59:32 +02:00
|
|
|
force: true
|