paulbsd-salt/states/influxdb/v2/init_v2.sls

59 lines
1.6 KiB
Plaintext
Raw Normal View History

2020-07-10 00:58:55 +02:00
---
influxdb-group:
group.present:
- name: influxdb
- gid: {{ salt['pillar.get']('influxdb:gid') }}
influxdb-user:
user.present:
- name: influxdb
- uid: {{ salt['pillar.get']('influxdb:uid') }}
- gid: {{ salt['pillar.get']('influxdb:gid') }}
- allow_uid_change: True
- allow_gid_change: True
- home: /var/lib/influxdb
influxdb-archive-extract:
archive.extracted:
- source: {{ salt['pillar.get']('influxdb:mirror') }}/influxdb-{{ salt['pillar.get']('influxdb:version') }}_{{ salt['grains.get']('kernel')|lower }}_{{ salt['grains.get']('osarch') }}.tar.gz
- skip_verify: True
- archive_format: tar
- user: influxdb
- group: influxdb
- name: /usr/local
- if_missing: /usr/local/influxdb-{{ salt['pillar.get']('influxdb:version') }}_{{ salt['grains.get']('kernel')|lower }}_{{ salt['grains.get']('osarch') }}
influxdb_directory:
file.directory:
- name: /var/lib/influxdb
- user: influxdb
- group: influxdb
- recurse:
- user
- group
influxdb-link:
file.symlink:
- name: /usr/local/influxdb
- user: influxdb
- group: influxdb
- target: /usr/local/influxdb_{{ salt['pillar.get']('influxdb:version') }}_{{ salt['grains.get']('kernel')|lower }}_{{ salt['grains.get']('osarch') }}
- force: True
influxdb-influx-link:
file.symlink:
- name: /usr/sbin/influx
- target: /usr/local/influxdb/influx
influxdb-service-file:
file.managed:
- name: /lib/systemd/system/influxdb.service
- source: salt://influxdb/influxdb.service.j2
- user: root
- group: root
influxdb-service:
service.running:
- name: influxdb
- enable: True