Reload service after config change

Change-Id: I95356e865e04db04cdf37aee1f69590bddfc8980
diff --git a/telegraf/remote_agent.sls b/telegraf/remote_agent.sls
index f7123f1..2f32561 100644
--- a/telegraf/remote_agent.sls
+++ b/telegraf/remote_agent.sls
@@ -3,6 +3,9 @@
 
 {%- if remote_agent.get('enabled', False) %}
 
+{%- set remote_agent_label = pillar.get('docker', {}).get('client', {}).get('stack', {}).get('monitoring', {}).get('service', {}).get('remote_agent', {}).get('deploy', {}).get('labels', {}).get('com.mirantis.monitoring', 'remote_agent') %}
+{%- set docker_ids = salt['cmd.run']("docker ps -q -f 'label=com.mirantis.monitoring=" + remote_agent_label + "'") %}
+
 config_dir_remote_agent:
   file.directory:
     - name: {{remote_agent.dir.config}}
@@ -26,6 +29,10 @@
     - group: root
     - mode: 644
     - template: jinja
+    - onchanges_in:
+{%- for docker_id in docker_ids.split() %}
+      - cmd: {{docker_id}}_remote_agent_reload
+{%- endfor %}
     - require:
       - file: config_dir_remote_agent
     - context:
@@ -55,6 +62,10 @@
     - group: root
     - mode: 644
     - template: jinja
+    - onchanges_in:
+{%- for docker_id in docker_ids.split() %}
+      - cmd: {{docker_id}}_remote_agent_reload
+{%- endfor %}
     - require:
       - file: config_d_dir_remote_agent
     - defaults:
@@ -75,6 +86,10 @@
     - group: root
     - mode: 644
     - template: jinja
+    - onchanges_in:
+{%- for docker_id in docker_ids.split() %}
+      - cmd: {{docker_id}}_remote_agent_reload
+{%- endfor %}
     - require:
       - file: config_d_dir_remote_agent
     - defaults:
@@ -82,4 +97,10 @@
         values: {{ values }}
 
 {%- endfor %}
+
+{%- for docker_id in docker_ids.split() %}
+{{docker_id }}_remote_agent_reload:
+  cmd.run:
+    - name: docker kill -s SIGHUP {{ docker_id }}
+{%- endfor %}
 {%- endif %}