---
- name: Determine architecture for bazelisk download
  ansible.builtin.set_fact:
    build_arch: "{{ 'amd64' if ansible_architecture == 'x86_64' else 'arm64' }}"

- name: Fetch Bazelisk {{ bazelisk_version }} binary from Github
  become: true
  ansible.builtin.get_url:
    url: "https://github.com/bazelbuild/bazelisk/releases/download/{{ bazelisk_version }}/bazelisk-linux-{{ build_arch }}"
    dest: /usr/local/bin/bazel
    mode: 0755
    force: true
