Skip to content

Commit

Permalink
Trigger binary redownload on version, arch or os change
Browse files Browse the repository at this point in the history
  • Loading branch information
kazauwa committed Mar 18, 2024
1 parent 63e1952 commit fb4c0bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ headscale_version: '0.22.3'
headscale_os: 'linux'
headscale_arch: 'amd64'
headscale_user_name: 'headscale'
headscale_release_full: 'headscale_{{ headscale_version }}_{{ headscale_os }}_{{ headscale_arch }}'
headscale_user_group: '{{ headscale_user_name }}'
headscale_user_uid: '800'
headscale_user_gid: '{{ headscale_user_uid }}'
Expand Down
20 changes: 17 additions & 3 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,31 @@
system: true
create_home: false

- name: Get release checksums
ansible.builtin.uri:
url: 'https://github.com/juanfont/headscale/releases/download/v{{ headscale_version }}/checksums.txt'
return_content: true
register: checksums_file

- name: Parse checksums
ansible.builtin.set_fact:
headscale_checksums: '{{ checksums_file.content | split | reverse }}'

- name: Parse checksums (cont.)
ansible.builtin.set_fact:
headscale_checksums: '{{ dict(headscale_checksums[::2] | zip_longest(headscale_checksums[1::2])) }}'

- name: Download headscale binary
ansible.builtin.get_url:
# yamllint disable-line rule:line-length
url: 'https://github.com/juanfont/headscale/releases/download/v{{ headscale_version }}/headscale_{{ headscale_version }}_{{ headscale_os }}_{{ headscale_arch }}'
url: 'https://github.com/juanfont/headscale/releases/download/v{{ headscale_version }}/{{ headscale_release_full }}'
dest: '{{ headscale_binary_path }}'
checksum: 'sha256:{{ headscale_checksums[headscale_release_full] }}'
owner: '{{ headscale_user_uid }}'
group: '{{ headscale_user_gid }}'
mode: '0770'
notify: restart headscale

- name: Ensure headscale directories exist
- name: Ensure headscale paths exist
ansible.builtin.file:
path: '{{ item }}'
state: directory
Expand Down

0 comments on commit fb4c0bf

Please sign in to comment.