paulbsd-salt/states/influxdb/install.sls

56 lines
1.5 KiB
Plaintext

---
{%- from "influxdb/map.jinja" import influxdb with context %}
influxdb-group:
group.present:
- name: influxdb
- gid: {{ influxdb.group.gid }}
- watch_in:
- service: influxdb-service
influxdb-user:
user.present:
- name: influxdb
- uid: {{ influxdb.user.uid }}
- gid: {{ influxdb.group.gid }}
- allow_uid_change: true
- allow_gid_change: true
- home: /var/lib/influxdb
- watch_in:
- service: influxdb-service
influxdb-dependencies:
pkg.installed:
- pkgs: {{ influxdb.dependencies }}
influxdb-archive-extract:
archive.extracted:
- name: {{ influxdb.release_dir }}/influxdb-{{ influxdb.version }}
- source: {{ influxdb.mirror }}/influxdb-{{ influxdb.version }}_{{ influxdb.os }}_{{ influxdb.arch }}.tar.gz
- skip_verify: true
- archive_format: tar
- options: --strip 4
- enforce_toplevel: false
- if_missing: {{ influxdb.release_dir }}/influxdb-{{ influxdb.version }}/influxd
- watch_in:
- service: influxdb-service
influxdb-bin-symlink:
file.symlink:
- name: {{ influxdb.install_dir }}/influxdb
- target: {{ influxdb.release_dir }}/influxdb-{{ influxdb.version }}
influxdb-data-dir:
file.directory:
- name: {{ influxdb.data_dir }}
- user: {{ influxdb.user.uid }}
- group: {{ influxdb.group.gid }}
- watch_in:
- service: influxdb-service
{%- for bin in ['influx', 'influxd'] %}
influxdb-{{ bin }}-symlink:
file.symlink:
- name: /usr/local/sbin/{{ bin }}
- target: {{ influxdb.install_dir }}/influxdb/{{ bin }}
{%- endfor %}