init.sls 980 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #
  2. # Prometheus exporters to be set up
  3. #
  4. # All nodes get node_exporter
  5. prometheus-node-exporter:
  6. pkg.installed:
  7. - name: prometheus-node-exporter
  8. service.running:
  9. - enable: true
  10. - reload: true
  11. /etc/default/prometheus-node-exporter:
  12. file.managed:
  13. - source: salt://prometheus-exporters/node-exporter/prometheus-node-exporter.default
  14. - require:
  15. - pkg: prometheus-node-exporter
  16. - watch_in:
  17. - service: prometheus-node-exporter
  18. #
  19. # Role specific exporters
  20. #
  21. {% set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
  22. # DNS server
  23. {% if 'dns-recursor' in roles or 'dns-auth' in roles %}
  24. prometheus-bind-exporter:
  25. pkg.installed:
  26. - name: prometheus-bind-exporter
  27. service.running:
  28. - enable: true
  29. - reload: true
  30. {% endif %}
  31. # Routers
  32. {% if 'router' in roles %}
  33. prometheus-bird-exporter:
  34. pkg.installed:
  35. - name: prometheus-bird-exporter
  36. service.running:
  37. - enable: true
  38. - reload: true
  39. {% endif %}