---
# file: roles/netdata/tasks/apache.yml

- name: Enable Apache Status Module
  apache2_module:
    name: status
    state: present
  notify:
    - Restart Apache

- name: Apache Status Site
  template:
    src: apache.conf
    dest: /etc/apache2/sites-available/status{{ apache_conf_ext|default(".conf") }}
    owner: root
    group: root
    mode: 0644
  notify:
    - Restart Apache

- name: Enable Apache Status Site
  command: a2ensite status
  args:
    creates: /etc/apache2/sites-enabled/status{{ apache_conf_ext|default('.conf') }}
  notify:
    - Restart Apache

- name: Weblog Module Configuration
  template:
    src: web_log.conf
    dest: /etc/netdata/python.d/web_log.conf
    owner: netdata
    group: netdata
    mode: 0660

- name: Install Custom Alerts
  template:
    src: health/web_log.conf
    dest: /etc/netdata/health.d/web_log.conf
  notify:
    - Restart NetData