---

- name: Remount /usr RW
  include_role:
    name: evolix/remount-usr

- name: Install evoadmin-mail package
  apt:
    deb: /tmp/evoadmin-mail.deb
    state: present
  tags:
    - evoadmin-mail

- name: Configure contact mail
  ini_file:
    dest: /etc/evoadmin-mail/config.ini
    section: global
    option: mail
    value: "\"{{ evoadminmail_contact_email or general_alert_email | mandatory }}\""
  tags:
    - evoadmin-mail

- include: ssl.yml

- include: apache.yml
  when: evoadminmail_webserver == "apache"

- include: nginx.yml
  when: evoadminmail_webserver == "nginx"

- name: enable evoadmin-mail link in default site index
  lineinfile:
    dest: /var/www/index.html
    state: present
    regexp: "EvoAdmin-mail"
    line: '            <li><a href="https://{{ evoadminmail_host }}">Interface admin mail (EvoAdmin-mail)</a></li>'
    insertbefore: "</ul>"
  tags:
    - evoadmin-mail
