From fa60977155215dfb6b872b3bcf17c765fc166f7b Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Wed, 20 Mar 2024 14:56:04 +0100 Subject: [PATCH] updated telegraf state --- states/telegraf/config.sls | 4 +--- states/telegraf/install.sls | 6 ------ states/telegraf/service.sls | 8 ++++++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/states/telegraf/config.sls b/states/telegraf/config.sls index 6ee63a5..25250f3 100644 --- a/states/telegraf/config.sls +++ b/states/telegraf/config.sls @@ -6,11 +6,9 @@ telegraf-config-dir: - user: root - group: root - mode: 700 - - watch_in: - - service: telegraf-service {% for cfg, value in telegraf.config.items() %} -telegraf-config-file: +telegraf-config-{{ cfg }}-file: file.managed: - name: /etc/telegraf/{{ cfg }}.conf - source: salt://telegraf/templates/telegraf.conf.j2 diff --git a/states/telegraf/install.sls b/states/telegraf/install.sls index bf052fe..b68f3b0 100644 --- a/states/telegraf/install.sls +++ b/states/telegraf/install.sls @@ -15,16 +15,12 @@ telegraf-archive-extract: - 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: @@ -33,8 +29,6 @@ telegraf-defaults-file: - user: root - group: root - template: jinja - - watch_in: - - service: telegraf-service telegraf-cleanup: software.cleanup: diff --git a/states/telegraf/service.sls b/states/telegraf/service.sls index 4d216dc..9f111af 100644 --- a/states/telegraf/service.sls +++ b/states/telegraf/service.sls @@ -7,12 +7,16 @@ telegraf-service-file: - user: root - group: root - template: jinja - - watch_in: - - service: telegraf-service {% for cfg, value in telegraf.config.items() %} telegraf-{{ cfg }}-service: service.running: - name: telegraf@{{ cfg }} - enable: true + - watch: + - archive: telegraf-archive-extract + - file: telegraf-service-file + - file: telegraf-bin-symlink + - file: telegraf-defaults-file + - file: telegraf-config-dir {% endfor %}