init.sls 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #
  2. # influxdb
  3. #
  4. influxdb:
  5. file.managed:
  6. - names:
  7. - /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg:
  8. - source: salt://influxdb/influxdata-archive_compat.gpg
  9. - /etc/apt/sources.list.d/influxdb.list:
  10. - source: salt://influxdb/influxdb.list.tmpl
  11. - template: jinja
  12. - require:
  13. - file: /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg
  14. pkg.installed:
  15. - name: influxdb
  16. - require:
  17. - file: /etc/apt/sources.list.d/influxdb.list
  18. service.running:
  19. - name: influxdb
  20. - enable: True
  21. - require:
  22. - pkg: influxdb
  23. - file: /etc/influxdb/influxdb.conf
  24. - watch:
  25. - file: /etc/influxdb/influxdb.conf
  26. user.present:
  27. - name: influxdb
  28. - system: True
  29. - groups:
  30. - ssl-cert
  31. - require:
  32. - pkg: influxdb
  33. /etc/influxdb/influxdb.conf:
  34. file.managed:
  35. - source: salt://influxdb/influxdb.conf.tmpl
  36. - template: jinja
  37. - require:
  38. - pkg: influxdb
  39. /usr/local/sbin/backup-influx.sh:
  40. file.managed:
  41. - source: salt://influxdb/backup.sh
  42. - mode: 700
  43. - user: influxdb
  44. /etc/cron.d/backup-influx:
  45. file.managed:
  46. - contents: "0 22 * * * influxdb [ -f /usr/local/sbin/backup-influx.sh ] && /usr/local/sbin/backup-influx.sh"
  47. - require:
  48. - file: /usr/local/sbin/backup-influx.sh