dj-wasabi / ansible-telegraf

Installing and configuring Telegraf via Ansible for RedHat/Debian/Ubuntu/Windows/Suse.
MIT License
134 stars 116 forks source link

New Debian runs fail due to package user/group name changes #185

Open danclough opened 7 months ago

danclough commented 7 months ago

Describe the bug In recent versions of the telegraf .deb package, it appears that the InfluxDB team has begun to follow Debian Policy §9.2.1 which states that package-owned user and group names should begin with an underscore (_) so there are no name collisions with locally-created users.

This causes the Telegraf playbook to fail because it expects a user/group named "telegraf" to exist after package installation, but does not find it, so the permissions can't be set on the config files.

Installation method/version

Ansible Version

AWX/Ansible 2.15

Targetted hosts Concerns the following OS(es):

Expected behavior The playbook may need to be modified to check if the newly-created user and group are prefixed with an underscore, and to use that value accordingly when setting ownership of the config.

Additional context If you manually rename the user/group to remove the underscore, and also change the systemd unit file to reflect the new user/group name, everything with this playbook works as expected. But this is obviously a manual intervention workaround, which is not ideal. I don't know when I'll have time to look deeper into a solution but wanted to share the finding here in case others run into this issue as well.

danclough commented 7 months ago

It looks like the new telegraf .deb packages specify the username in the .postinst file as a variable "TELEGRAF_USER", so you can check for the value using this:

grep '^TELEGRAF_USER=' /var/lib/dpkg/info/telegraf.postinst | sed -r 's:TELEGRAF_USER="(.*)":\1:'

And my guess is if you don't see that, it'd be safe to default to telegraf.