Merge pull request #4 from nuz014/latest-version

Latest version
This commit is contained in:
Sondre Batalden 2026-03-20 11:42:02 +01:00 committed by GitHub
commit a0414e3f07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View file

@ -69,7 +69,7 @@ ansible-galaxy install roles-ansible.restic
| Name | Default | Description |
|-------------------------------|---------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| `restic_url` | `undefined` | The URL to download restic from. Use this variable to overwrite the default |
| `restic_version` | `'0.15.1'` | The version of Restic to install |
| `restic_version` | `'0.18.1'` | The version of Restic to install. Set to `'latest'` to automatically fetch and install the newest release from GitHub. |
| `restic_download_path` | `'/opt/restic'` | Download location for the restic binary |
| `restic_install_path` | `'/usr/local/bin'` | Install location for the restic binary |
| `restic_script_dir` | `'/opt/restic'` | Location of the generated backup scripts |

View file

@ -1,6 +1,6 @@
---
restic_url: '{{ restic_url_default }}'
restic_version: '0.16.3'
restic_version: '0.16.3' # set to 'latest' to automatically fetch the newest release
restic_download_path: '/opt/restic'
restic_install_path: '/usr/local/bin'
restic_script_dir: '/opt/restic'

View file

@ -1,4 +1,16 @@
---
- name: (PREPARE) Fetch latest restic version from GitHub API
ansible.builtin.uri:
url: 'https://api.github.com/repos/restic/restic/releases/latest'
return_content: true
register: restic_latest_release
when: restic_version == 'latest'
- name: (PREPARE) Set restic_version to latest release
ansible.builtin.set_fact:
restic_version: '{{ restic_latest_release.json.tag_name | regex_replace("^v", "") }}'
when: restic_version == 'latest'
- name: (PREPARE) Ensure restic directories exist
become: true
ansible.builtin.file: