telgraf: Fix config folder permissions

With the recent update to telegraf's container image it now runs under its own user and thus we need to change the permissions to make the config file accessible for the new user.

See https://github.com/influxdata/influxdata-docker/pull/536
This commit is contained in:
Saibotk 2021-10-29 23:33:21 +02:00
parent 4d1bb93d2a
commit a178af1735
Signed by: saibotk
GPG key ID: 67585F0065E261D5
2 changed files with 12 additions and 5 deletions

View file

@ -27,8 +27,15 @@ telegraf_config_location: "{{ telegraf_install_location }}/conf"
telegraf_version: "1.20.3"
# renovate: depName=quay.io/sheogorath/docker-socket-proxy
telegraf_dockersocketproxy_version: "2.3"
# Changing this image may also require changing the UID / GID below,
# to set the correct permissions
telegraf_image_version: "{{ telegraf_version }}-alpine"
# Telegraf config user & group id
# This is used for the config folder that is mounted to the container
telegraf_config_uid: 100
telegraf_config_gid: 101
# The influxdb endpoints, telegraf should send data to
telegraf_influxdb_endpoints:
- influxdb.example.com

View file

@ -41,8 +41,8 @@
file:
path: "{{ item }}"
mode: '0700'
owner: 'root'
group: 'root'
owner: "{{ telegraf_config_uid }}"
group: "{{ telegraf_config_gid }}"
state: directory
setype: "container_file_t"
with_items:
@ -63,9 +63,9 @@
template:
src: "telegraf.conf"
dest: "{{ telegraf_config_location }}/telegraf.conf"
mode: '0644'
owner: 'root'
group: 'root'
mode: '0600'
owner: "{{ telegraf_config_uid }}"
group: "{{ telegraf_config_gid }}"
notify: "Restart telegraf"
become: true