- block:

  - include_vars:
      file: vars/bazel.yml
  - include_vars:
      file: vars/java.yml
  - include_vars:
      file: vars/unshare.yml

  - name: Install Java
    http_deb:
      name: oracle-java8-jdk
      version: "{{ java_version }}"
      url: "{{ java_download_url }}"
      checksum: "sha256:{{ java_sha }}"

  - name: Install unshare-2.36 from util-linux-2.36
    http_deb:
      name: util-linux2.36
      version: "{{ util_linux_version }}"
      url: "{{ util_linux_download_url }}"
      checksum: "sha256:{{ util_linux_sha }}"

  - name: Remove local bazel binary
    file:
      path: "~/bazel/output/bazel"
      state: absent

  # The Bazel deb needs this to be installed or the following `http_deb` step will fail.
  - name: Install bash-completion package.
    apt:
      name: "bash-completion"
      install_recommends: no
      cache_valid_time: "{{ apt_cache_valid_time }}"

  - name: Install Bazel
    http_deb:
      name: bazel
      version: "{{ bazel.version }}"
      url: "{{ bazel_download_url }}"
      checksum: "sha256:{{ bazel_sha }}"

  become: yes
