init.sls 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #
  2. # grafana
  3. #
  4. grafana:
  5. # add Grafana Repo
  6. pkgrepo.managed:
  7. - humanname: Grafana Repo
  8. - name: deb https://packagecloud.io/grafana/stable/debian/ jessie main
  9. - file: /etc/apt/sources.list.d/grafana.list
  10. - key_url: https://packagecloud.io/grafana/stable/gpgkey
  11. # install grafana
  12. pkg.installed:
  13. - name: grafana
  14. - require:
  15. - pkgrepo: grafana
  16. - pkgrepo: grafana-src
  17. service.running:
  18. - name: grafana-server
  19. - enable: True
  20. - require:
  21. - pkg: grafana
  22. - file: /etc/grafana/grafana.ini
  23. - file: /etc/grafana/ldap.toml
  24. - user: grafana
  25. - watch:
  26. - file: /etc/grafana/grafana.ini
  27. - file: /etc/grafana/ldap.toml
  28. # add user 'grafana' to group 'ssl-cert' to access ssl-key file
  29. user.present:
  30. - name: grafana
  31. - system: True
  32. - groups:
  33. - ssl-cert
  34. - require:
  35. - pkg: grafana
  36. # add Grafana src-Repo
  37. grafana-src:
  38. pkgrepo.managed:
  39. - humanname: Grafana Repo
  40. - name: deb-src https://packagecloud.io/grafana/stable/debian/ jessie main
  41. - file: /etc/apt/sources.list.d/grafana.list
  42. - key_url: https://packagecloud.io/grafana/stable/gpgkey
  43. # copy custom config
  44. /etc/grafana/grafana.ini:
  45. file.managed:
  46. - source: salt://grafana/grafana.ini.tmpl
  47. - template: jinja
  48. - require:
  49. - pkg: grafana
  50. # copy LDAP config
  51. /etc/grafana/ldap.toml:
  52. file.managed:
  53. - source: salt://grafana/ldap.toml
  54. - template: jinja
  55. - require:
  56. - pkg: grafana