# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-

---

- name: "toxcore Ubuntu.yml"
  debug:
    verbosity: 1
    msg: "toxcore Ubuntu.yml"

- name: uninstall toxcore_lxd_debs_absent packages
  environment:
    - "RUNLEVEL": 1
  apt:
    force_apt_get: true
    name: "{{item}}"
    state: absent
    update_cache: no
  when:
    - item != ''
    - not ansible_check_mode
    - "'lxd' not in TOXCORE_FEATURES"
  with_items: "{{ toxcore_lxd_debs_absent }}"

- name: "install toxcore_debs_inst packages"
  environment:
    - "RUNLEVEL": 1
  shell: |
    apt-get install -y \
     "{{ toxcore_debs_inst|join('') }}" \
     "{{ toxcore_qemu_debs_inst|join('') if 'qemu' in TOXCORE_FEATURES else '' }}" \
     "{{ toxcore_libvirt_debs_inst|join('') if 'libvirt' in TOXCORE_FEATURES else '' }}" \
     "{{ toxcore_docker_debs_inst|join('') if 'docker' in TOXCORE_FEATURES else '' }}" \
      {{ '--print-uris' if BASE_ARE_CONNECTED|default('') == '' else '' }}
  when:
    - "item != ''"
    - not ansible_check_mode
    - "BASE_ARE_CONNECTED|default('') != ''"
  ignore_errors: "{{ BASE_PKG_IGNORE_ERRORS }}"

- block:

  - name: "toxcore Ubuntu18.yml"
    debug:
      verbosity: 1
      msg: "toxcore Ubuntu18.yml"

  when: ansible_distribution_major_version == 18

