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

- name: "NetData Role"
  set_fact: role_netdata_started=true
  tags: always

- block:

  - include_tasks: prepare.yml

  - include_tasks: install.yml

  - include_tasks: configure.yml

  - include_tasks: apache.yml
    when: groups['webserver'] is defined and inventory_hostname in groups['webserver']

  - include_tasks: elasticsearch.yml
    when: groups['logserver'] is defined and inventory_hostname in groups['logserver']

  - include_tasks: haproxy.yml
    when: groups['proxyserver'] is defined and inventory_hostname in groups['proxyserver']

  - include_tasks: mysql.yml
    when: groups['dbserver-mysql'] is defined and inventory_hostname in groups['dbserver-mysql']

  - include_tasks: silent.yml

  - include_tasks: varnish.yml
    when: groups['varnishserver'] is defined and inventory_hostname in groups['varnishserver']

  when: '"netdata" not in excluded_roles'
