paulbsd-salt/states/telegraf/install.sls
Paul Lecuq 0db6152602
All checks were successful
continuous-integration/drone/push Build is passing
updated telegraf state
2023-08-07 16:05:24 +02:00

44 lines
1.4 KiB
Plaintext

---
{%- from "telegraf/map.jinja" import telegraf with context %}
{% set archive_exclude_dir = './telegraf-' + telegraf.version %}
telegraf-archive-extract:
archive.extracted:
- name: {{ telegraf.release_dir }}/telegraf-{{ telegraf.version }}
- source: {{ telegraf.mirror }}/telegraf-{{ telegraf.version }}_{{ salt['grains.get']('kernel')|lower }}_{{ telegraf.arch }}.tar.gz
- enforce_toplevel: false
- options: >
--transform 's|^\{{ archive_exclude_dir }}|/|g'
--exclude '{{ archive_exclude_dir }}/etc'
--exclude '{{ archive_exclude_dir }}/usr/lib'
--exclude '{{ archive_exclude_dir }}/var'
--strip 2
- skip_verify: true
- archive_format: tar
- if_missing: {{ telegraf.release_dir }}/telegraf-{{ telegraf.version }}/telegraf
- watch_in:
- service: telegraf-service
telegraf-bin-symlink:
file.symlink:
- name: /usr/local/bin/telegraf
- target: {{ telegraf.release_dir }}/telegraf-{{ telegraf.version }}/telegraf
- force: true
- watch_in:
- service: telegraf-service
telegraf-defaults-file:
file.managed:
- name: /etc/default/telegraf
- source: salt://telegraf/templates/telegraf_default.j2
- user: root
- group: root
- template: jinja
- watch_in:
- service: telegraf-service
telegraf-cleanup:
software.cleanup:
- name: telegraf
- path: {{ telegraf.release_dir }}
- version: "{{ telegraf.version }}"