---

- name: Download artifacts
  unarchive:
    src: "{{ kata_containers_release_url }}"
    dest: /
    remote_src: true

- name: Create config directory
  file:
    path: "{{ kata_containers_config_dir }}"
    state: directory

- name: Set configuration
  template:
    src: "{{ item }}.j2"
    dest: "{{ kata_containers_config_dir }}/{{ item }}"
  with_items:
    - configuration-qemu.toml

- name: Set containerd bin
  vars:
    shim: "{{ item }}"
  template:
    dest: "{{ kata_containers_containerd_bin_dir }}/containerd-shim-kata-{{ item }}-v2"
    src: containerd-shim-kata-v2.j2
    mode: 0755
  with_items:
    - qemu
