---
{%- from "influxdb/map.jinja" import influxdb with context %}
influxdb-config-dir:
  file.directory:
    - name: {{ influxdb.config_dir }}
    - user: {{ influxdb.user.name }}
    - group: {{ influxdb.group.name }}
    - watch_in:
      - service: influxdb-service

influxdb-config-file:
  file.managed:
    - name: {{ influxdb.config_dir }}/{{ influxdb.config_file }}
    - source: salt://influxdb/templates/influxdb.conf.j2
    - user: {{ influxdb.user.name }}
    - group: {{ influxdb.group.name }}
    - mode: 644
    - template: jinja
    - watch_in:
      - service: influxdb-service