mirror of
https://github.com/dj-wasabi/ansible-telegraf.git
synced 2025-07-17 08:46:37 +00:00
Merge pull request #60 from gaizeror/wipe-non-ansible-extra-plugins
Added support for plugins being managed exclusively by this playbook
This commit is contained in:
@ -98,6 +98,7 @@ The 2nd parameter `telegraf_plugins_extra` can be used to add plugins specific t
|
|||||||
config:
|
config:
|
||||||
- servers = ["root:{{ mysql_root_password }}@tcp(localhost:3306)/"]
|
- servers = ["root:{{ mysql_root_password }}@tcp(localhost:3306)/"]
|
||||||
|
|
||||||
|
There is an option to delete extra-plugin files in /etc/telegraf/telegraf.d if they weren't generated by this playbook with `telegraf_plugins_extra_exclusive` variable.
|
||||||
|
|
||||||
Telegraf plugin options:
|
Telegraf plugin options:
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ telegraf_plugins_default:
|
|||||||
|
|
||||||
# extra configuration - /etc/telegraf/telegraf.d/*
|
# extra configuration - /etc/telegraf/telegraf.d/*
|
||||||
telegraf_plugins_extra: {}
|
telegraf_plugins_extra: {}
|
||||||
|
telegraf_plugins_extra_exclusive: False
|
||||||
|
|
||||||
# RedHat specific settings for convenience
|
# RedHat specific settings for convenience
|
||||||
telegraf_redhat_releasever: "$releasever"
|
telegraf_redhat_releasever: "$releasever"
|
||||||
|
@ -35,6 +35,30 @@
|
|||||||
when: telegraf_agent_version is version_compare('0.10.0', '>=')
|
when: telegraf_agent_version is version_compare('0.10.0', '>=')
|
||||||
notify: "Restart Telegraf"
|
notify: "Restart Telegraf"
|
||||||
|
|
||||||
|
- name: "Check if extra plugins directory exists in case of exclusive"
|
||||||
|
action: stat path=/etc/telegraf/telegraf.d
|
||||||
|
register: telegraf_directory
|
||||||
|
when: telegraf_plugins_extra_exclusive
|
||||||
|
|
||||||
|
- name: "Delete telegraf extra plugin path"
|
||||||
|
file:
|
||||||
|
state: absent
|
||||||
|
path: "/etc/telegraf/telegraf.d/"
|
||||||
|
when: telegraf_plugins_extra_exclusive and telegraf_directory.stat.exists
|
||||||
|
become: yes
|
||||||
|
notify: "Restart Telegraf"
|
||||||
|
|
||||||
|
- name: "Create telegraf extra plugin path"
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "/etc/telegraf/telegraf.d/"
|
||||||
|
owner: telegraf
|
||||||
|
group: telegraf
|
||||||
|
mode: 0740
|
||||||
|
when: telegraf_plugins_extra_exclusive and telegraf_directory.stat.exists
|
||||||
|
become: yes
|
||||||
|
notify: "Restart Telegraf"
|
||||||
|
|
||||||
- name: "Copy telegraf extra plugins"
|
- name: "Copy telegraf extra plugins"
|
||||||
template:
|
template:
|
||||||
src: "telegraf-extra-plugin.conf.j2"
|
src: "telegraf-extra-plugin.conf.j2"
|
||||||
|
Reference in New Issue
Block a user