---
- name: netcapture install
  ansible.builtin.apt:
    force_apt_get: true
    install_recommends: false
    name: ubicast-netcapture
  register: apt_status
  retries: 60
  until: apt_status is success or ('Failed to lock apt for exclusive operation' not in apt_status.msg and '/var/lib/dpkg/lock' not in apt_status.msg)

- name: netcapture config
  ansible.builtin.template:
    src: netcapture.json.j2
    dest: /etc/miris/netcapture.json
    mode: "644"

- name: netcapture miris
  ansible.builtin.template:
    src: miris-api.json.j2
    dest: /etc/miris/conf/api.json
    mode: "644"

- name: netcapture config dir
  ansible.builtin.file:
    path: "{{ netcapture_conf_folder }}"
    group: video
    mode: u=rwX,g=rwX,o=r
    recurse: true
    state: directory

- name: netcapture media dir
  ansible.builtin.file:
    path: "{{ netcapture_media_folder }}"
    group: video
    mode: u=rwX,g=rwX,o=rx
    state: directory

- name: netcapture package dir
  ansible.builtin.file:
    path: "{{ netcapture_pkg_folder }}"
    mode: u=rwX,g=rwX,o=rx
    state: directory
