Merge "Clean telegraf conf.d directory"
diff --git a/telegraf/agent.sls b/telegraf/agent.sls
index 3b677bc..249ab22 100644
--- a/telegraf/agent.sls
+++ b/telegraf/agent.sls
@@ -19,6 +19,15 @@
     - context:
       agent: {{ agent }}
 
+config_d_dir_agent:
+  file.directory:
+    - name: {{agent.dir.config_d}}
+    - makedirs: True
+    - clean: True
+    - mode: 755
+    - require:
+      - pkg: telegraf_packages_agent
+
 {%- for name,values in agent.input.iteritems() %}
 
 {%- if values is not mapping or values.get('enabled', True) %}
@@ -34,6 +43,7 @@
     - template: jinja
     - require:
       - pkg: telegraf_packages_agent
+      - file: config_d_dir_agent
     - watch_in:
       - service: telegraf_service_agent
     - defaults:
@@ -50,14 +60,6 @@
       - pkg: telegraf_packages_agent
 {%- endif %}
 
-{%- else %}
-input_{{name }}_agent:
-  file.absent:
-    - name: {{ agent.dir.config_d }}/input-{{ name }}.conf
-    - require:
-      - pkg: telegraf_packages_agent
-    - watch_in:
-      - service: telegraf_service_agent
 {%- endif %}
 
 {%- endfor %}
@@ -74,6 +76,7 @@
     - template: jinja
     - require:
       - pkg: telegraf_packages_agent
+      - file: config_d_dir_agent
     - watch_in:
       - service: telegraf_service_agent
     - defaults:
diff --git a/telegraf/remote_agent.sls b/telegraf/remote_agent.sls
index ca83129..d79ffb3 100644
--- a/telegraf/remote_agent.sls
+++ b/telegraf/remote_agent.sls
@@ -13,6 +13,7 @@
   file.directory:
     - name: {{remote_agent.dir.config_d}}
     - makedirs: True
+    - clean: True
     - mode: 755
     - require:
       - file: config_dir_remote_agent
@@ -57,12 +58,6 @@
         name: {{ name }}
         values: {{ values }}
 
-{%- else %}
-input_{{name }}_remote_agent:
-  file.absent:
-    - name: {{ remote_agent.dir.config_d }}/input-{{ name }}.conf
-    - require:
-      - file: config_d_dir_remote_agent
 {%- endif %}
 
 {%- endfor %}