---

- when: bb_install_mode != 'none'
  block:

    - name: Download babashka archive
      get_url:
        url: "{{ bb_archive_url }}"
        dest: /tmp/
        checksum: sha256:{{ bb_archive_sha256 }}

    - name: Extract archive
      unarchive:
        src: /tmp/babashka-{{ bb_version }}-linux-amd64-static.tar.gz
        dest: /tmp/
        remote_src: True

    - name: Install babashka binary
      copy:
        src: /tmp/bb
        dest: /usr/local/bin/bb
        remote_src: True
        mode: 755

  tags: bb
