---

- name: "System compatibility checks"
  assert:
    that:
      - ansible_distribution == "Debian"
      - ansible_distribution_major_version is version('8', '>=')
    msg: only compatible with Debian >= 8

- name: Apt configuration
  include_role:
    name: evolix/apt
  vars:
    apt_install_basics: "{{ evolinux_apt_replace_default_sources }}"
    apt_install_evolix_public: "{{ evolinux_apt_public_sources }}"
  when: evolinux_apt_include

- name: /etc versioning with Git
  include_role:
    name: evolix/etc-git
  when: evolinux_etcgit_include

- name: /etc/evolinux base
  include: etc-evolinux.yml
  when: evolinux_etcevolinux_include

- name: Hostname
  include: hostname.yml
  when: evolinux_hostname_include

- name: Kernel tuning
  include: kernel.yml
  when: evolinux_kernel_include

- name: Fstab configuration
  include: fstab.yml
  when: evolinux_fstab_include

- name: Packages
  include: packages.yml
  when: evolinux_packages_include

- name: System settings
  include: system.yml
  when: evolinux_system_include

- name: Minifirewall
  include_role:
    name: evolix/minifirewall
  when: evolinux_minifirewall_include

- name: Evomaintenance
  include_role:
    name: evolix/evomaintenance
  when: evolinux_evomaintenance_include

- name: SSH configuration
  include: ssh.yml
  when: evolinux_ssh_include

### disabled because of a memory leak
# - name: Create evolinux users
#   include_role:
#     name: evolix/evolinux-users
#   when: evolinux_users_include

- name: Root user configuration
  include: root.yml
  when: evolinux_root_include

- name: Postfix
  include: postfix.yml
  when: evolinux_postfix_include

- name: Logs management
  include: logs.yml
  when: evolinux_logs_include

- name: Default index page
  include: default_www.yml
  when: evolinux_default_www_include

- name: Hardware drivers and tools
  include: hardware.yml
  when: evolinux_hardware_include

- name: Customize for Online.net
  include: provider_online.yml
  when: evolinux_provider_online_include

- name: Customize for Orange FCE
  include: provider_orange_fce.yml
  when: evolinux_provider_orange_fce_include

- name: Override Log2mail service
  include: log2mail.yml
  when: evolinux_log2mail_include

- include: motd.yml

- name: Munin
  include_role:
    name: evolix/munin
  when: evolinux_munin_include

- name: Nagios/NRPE
  include_role:
    name: evolix/nagios-nrpe
  when: evolinux_nagios_nrpe_include

- name: fail2ban
  include_role:
    name: evolix/fail2ban
  when: evolinux_fail2ban_include

- name: Evocheck
  include_role:
    name: evolix/evocheck
  vars:
    evocheck_force_install: "{{ evolinux_evocheck_force_install }}"
  when: evolinux_evocheck_include

- name: Listupgrade
  include_role:
    name: evolix/listupgrade
  when: evolinux_listupgrade_include

- name: Generate ldif script
  include_role:
    name: evolix/generate-ldif
  when: evolinux_generateldif_include
