telegraf: Move config into repository
This commit is contained in:
parent
eb1478abcb
commit
47157118e7
2 changed files with 39 additions and 3 deletions
|
@ -9,10 +9,10 @@
|
|||
name: telegraf
|
||||
state: installed
|
||||
|
||||
- name: Copy config
|
||||
ansible.builtin.copy:
|
||||
- name: Create config
|
||||
ansible.builtin.template:
|
||||
dest: /etc/telegraf/telegraf.conf
|
||||
src: "{{ ansible_private }}/files/telegraf/telegraf.conf"
|
||||
src: telegraf.conf.j2
|
||||
mode: "0640"
|
||||
owner: root
|
||||
group: _telegraf
|
||||
|
|
36
roles/telegraf/templates/telegraf.conf.j2
Normal file
36
roles/telegraf/templates/telegraf.conf.j2
Normal file
|
@ -0,0 +1,36 @@
|
|||
[[outputs.influxdb_v2]]
|
||||
urls = ["https://influxdb.foo.sh:443"]
|
||||
token = "{{ influxdb_token }}"
|
||||
organization = "foo.sh"
|
||||
bucket = "sensordata"
|
||||
|
||||
[[inputs.mqtt_consumer]]
|
||||
servers = ["ssl://{{ inventory_hostname }}:8883"]
|
||||
tls_ca = "{{ tls_certs }}/ca.crt"
|
||||
tls_cert = "{{ tls_certs }}/{{ inventory_hostname }}.crt"
|
||||
tls_key = "{{ tls_private }}/{{ inventory_hostname }}.key"
|
||||
topics = [
|
||||
"+/+/+/relay/0/power",
|
||||
"+/+/+/temperature",
|
||||
"+/+/+/sensor/battery",
|
||||
"+/+/+/sensor/lux",
|
||||
"+/+/+/sensor/state",
|
||||
"+/+/+/sensor/temperature",
|
||||
]
|
||||
data_type = "float"
|
||||
data_format = "value"
|
||||
|
||||
[[inputs.mqtt_consumer.topic_parsing]]
|
||||
topic = "+/+/+/relay/0/power"
|
||||
tags = "location/room/device/_/_/_"
|
||||
measurement = "_/_/_/_/_/measurement"
|
||||
|
||||
[[inputs.mqtt_consumer.topic_parsing]]
|
||||
topic = "+/+/+/temperature"
|
||||
tags = "location/room/device/_"
|
||||
measurement = "_/_/_/temperature"
|
||||
|
||||
[[inputs.mqtt_consumer.topic_parsing]]
|
||||
topic = "+/+/+/sensor/+"
|
||||
tags = "location/room/device/_/_"
|
||||
measurement = "_/_/_/_/measurement"
|
Loading…
Add table
Reference in a new issue