---
- name: install podman
  yum:
    name: podman
    state: latest
  when:
    - inventory_hostname in groups['crio']

- name: nerdctl tar.gz copy
  copy:
    src: "{{ role_path }}/files/host-agent/nerdctl-0.19.0-linux-amd64.tar.gz"
    dest: /root
  when:
    - inventory_hostname in groups['containerd']

- name: nerdctl unarchive
  unarchive:
    src: /root/nerdctl-0.19.0-linux-amd64.tar.gz
    dest: /usr/local/bin
    remote_src: yes
  when:
    - inventory_hostname in groups['containerd']

- name: host-agent.tar.gz copy
  copy:
    src: "{{ role_path }}/files/host-agent/host-agent.tar.gz"
    dest: /root/
  when:
    - inventory_hostname in groups['containerd'] or inventory_hostname in groups['docker'] or inventory_hostname in groups['crio']

- name: create host-agent directory
  file:
    path: /root/host-agent
    state: directory
  when:
    - inventory_hostname in groups['containerd'] or inventory_hostname in groups['docker'] or inventory_hostname in groups['crio']

- name: host-agent.tar.gz unarchive
  unarchive:
    src: /root/host-agent.tar.gz
    dest: /root/host-agent/
    remote_src: yes
  when:
    - inventory_hostname in groups['containerd'] or inventory_hostname in groups['docker'] or inventory_hostname in groups['crio']
