[ansible] Use collectd_config for default_read_plugins
[barometer.git] / docker / ansible / roles / config_files / tasks / network.yml
index dca0c23..52902d4 100644 (file)
 # limitations under the License.
 ---
 
-- name: enable network plugin
+- name: Enable network plugin
   template:
     src: network.conf.j2
     dest: "{{ config_file_dir }}/network.conf"
   tags:
      - network
+
+- name: Add network port if defined
+  lineinfile:
+    dest: "{{ config_file_dir }}/network.conf"
+    insertafter: Plugin network
+    line: "    Server \"{{ network_ip_addr }}\" \"{{ network_port }}\""
+  when: network_ip_addr is defined
+  tags:
+   - network
+
+- name: Modify network.conf to add influxdb_hosts
+  lineinfile:
+    dest: "{{ config_file_dir }}/network.conf"
+    insertafter: Plugin network
+    line: "    Server \"{{ item }}\" \"{{ influx_network_port }}\""
+  with_items: "{{ groups['influxdb_hosts'] }}"
+  tags:
+   - network
+