---
- name: Install evoadminmail VHost
  template:
    src: apache_evoadminmail.conf.j2
    dest: /etc/apache2/sites-available/evoadminmail.conf
  notify: reload apache2
  tags:
    - evoadmin-mail

- name: Enable evoadminmail vhost
  file:
    src: "/etc/apache2/sites-available/evoadminmail.conf"
    dest: "/etc/apache2/sites-enabled/evoadminmail.conf"
    state: link
  notify: reload apache2
  when: evoadminmail_enable_vhost
  tags:
    - evoadmin-mail

- name: Disable evoadminmail vhost
  file:
    dest: "/etc/apache2/sites-enabled/evoadminmail.conf"
    state: absent
  notify: reload apache2
  when: not evoadminmail_enable_vhost
  tags:
    - evoadmin-mail
