init.sls 1.1 KB

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