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

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

- block:

  - import_tasks: prepare.yml

  - import_tasks: install.yml

  - import_tasks: configure.yml

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

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

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

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

  - import_tasks: silent.yml

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

  - import_tasks: heartbeat.yml

  when: '"netdata" not in excluded_roles'
