mirror of
https://github.com/dj-wasabi/ansible-telegraf.git
synced 2025-07-17 08:46:37 +00:00
[FIX] added a check if dir exists, else skip
This commit is contained in:
@ -35,11 +35,15 @@
|
|||||||
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"
|
||||||
|
|
||||||
|
- action: stat path=/etc/telegraf/telegraf.d
|
||||||
|
register: telegraf_directory
|
||||||
|
when: telegraf_plugins_extra_exclusive
|
||||||
|
|
||||||
- name: "Delete telegraf extra plugin path"
|
- name: "Delete telegraf extra plugin path"
|
||||||
file:
|
file:
|
||||||
state: absent
|
state: absent
|
||||||
path: "/etc/telegraf/telegraf.d/"
|
path: "/etc/telegraf/telegraf.d/"
|
||||||
when: "telegraf_plugins_extra_exclusive == True"
|
when: telegraf_plugins_extra_exclusive and telegraf_directory.stat.exists
|
||||||
become: yes
|
become: yes
|
||||||
notify: "Restart Telegraf"
|
notify: "Restart Telegraf"
|
||||||
|
|
||||||
@ -50,7 +54,7 @@
|
|||||||
owner: telegraf
|
owner: telegraf
|
||||||
group: telegraf
|
group: telegraf
|
||||||
mode: 0740
|
mode: 0740
|
||||||
when: "telegraf_plugins_extra_exclusive == True"
|
when: telegraf_plugins_extra_exclusive and telegraf_directory.stat.exists
|
||||||
become: yes
|
become: yes
|
||||||
notify: "Restart Telegraf"
|
notify: "Restart Telegraf"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user