---

- name: "Compatibility check"
  fail:
    msg: only compatible with Debian >= 8
  when:
    - ansible_distribution != "Debian" or ansible_distribution_major_version is version('8', '<')
  tags:
    - apt

- name: Custom configuration
  include: config.yml
  when: apt_config | bool
  tags:
    - apt

- name: Install basics repositories
  include: basics.yml
  when: apt_install_basics | bool
  tags:
    - apt

- name: Install APT Backports repository
  include: backports.yml
  when: apt_install_backports | bool
  tags:
    - apt

- name: Install Evolix Public APT repository
  include: evolix_public.yml
  when: apt_install_evolix_public | bool
  tags:
    - apt

- name: Install check for packages marked hold
  include: hold_packages.yml
  when: apt_install_hold_packages | bool
  tags:
    - apt

- name: Updating APT cache
  apt:
    update_cache: yes
  changed_when: False
  tags:
    - apt

- name: Upgrading system
  apt:
    upgrade: dist
  when: apt_upgrade | bool
  tags:
    - apt