- name: Download Kiln Linux archive
  get_url:
    url: "https://github.com/Kiln-AI/Kiln/releases/download/{{ courseware_kiln_release_tag }}/Kiln.Linux.x64.zip"
    dest: "{{ courseware_downloads_dir }}/Kiln.Linux.x64.zip"
    mode: "0644"

- name: Create Kiln Linux directory
  file:
    path: "{{ courseware_apps_dir }}/kiln"
    state: directory
    mode: "0755"

- name: Unpack Kiln Linux binary
  unarchive:
    src: "{{ courseware_downloads_dir }}/Kiln.Linux.x64.zip"
    dest: "{{ courseware_apps_dir }}/kiln"
    remote_src: true
    creates: "{{ courseware_apps_dir }}/kiln/Kiln"

- name: Ensure Kiln Linux binary is executable
  file:
    path: "{{ courseware_apps_dir }}/kiln/Kiln"
    mode: "0755"
    state: file

