Download the uv build the Pi can actually run

Raspberry Pi OS ships a 64-bit kernel with a 32-bit userland, so uname -m - and
therefore ansible_architecture - reports aarch64 on a box whose /bin/ls is
ELF32 ARM and which has no /lib/ld-linux-aarch64.so.1. The aarch64 uv tarball
unpacked happily and then failed three tasks later with

    /usr/local/bin/uv: No such file or directory

which is the dynamic loader missing, not the file, and points at entirely the
wrong thing. Pick the target triple from ansible_userspace_bits instead, which
is the fact that tells the truth, and key the install directory on the triple as
well as the version - otherwise `creates:` would keep a wrong-architecture
binary in place forever. Then run `uv --version` right after installing it, so a
bad download fails where the cause is visible.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 19:59:43 +02:00
parent 3557fe3f2b
commit 331df52f0b
2 changed files with 26 additions and 5 deletions

View File

@@ -11,21 +11,21 @@
- name: Ensure uv install directory exists
ansible.builtin.file:
path: "/opt/uv-{{ pi_musicmouse_uv_version }}"
path: "/opt/uv-{{ pi_musicmouse_uv_version }}-{{ pi_musicmouse_uv_target }}"
state: directory
mode: "0755"
- name: Download and extract uv {{ pi_musicmouse_uv_version }}
ansible.builtin.unarchive:
src: "https://github.com/astral-sh/uv/releases/download/{{ pi_musicmouse_uv_version }}/uv-aarch64-unknown-linux-gnu.tar.gz"
dest: "/opt/uv-{{ pi_musicmouse_uv_version }}"
src: "https://github.com/astral-sh/uv/releases/download/{{ pi_musicmouse_uv_version }}/uv-{{ pi_musicmouse_uv_target }}.tar.gz"
dest: "/opt/uv-{{ pi_musicmouse_uv_version }}-{{ pi_musicmouse_uv_target }}"
remote_src: true
extra_opts: ["--strip-components=1"]
creates: "/opt/uv-{{ pi_musicmouse_uv_version }}/uv"
creates: "/opt/uv-{{ pi_musicmouse_uv_version }}-{{ pi_musicmouse_uv_target }}/uv"
- name: Symlink uv/uvx into /usr/local/bin
ansible.builtin.file:
src: "/opt/uv-{{ pi_musicmouse_uv_version }}/{{ item }}"
src: "/opt/uv-{{ pi_musicmouse_uv_version }}-{{ pi_musicmouse_uv_target }}/{{ item }}"
dest: "/usr/local/bin/{{ item }}"
state: link
force: true
@@ -33,6 +33,12 @@
- uv
- uvx
- name: Verify uv runs on this host
ansible.builtin.command:
cmd: /usr/local/bin/uv --version
register: pi_musicmouse_uv_version_out
changed_when: false
- name: Checkout Musicmouse repo
ansible.builtin.git:
repo: "{{ pi_musicmouse_repo }}"