summaryrefslogtreecommitdiff
path: root/roles/monitoring/collectd/base/tasks/main.yml
blob: fd0ef81aff87992b3c3bbc4f2340a5acfe14c30b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- name: install collectd packages
  apt:
    name: collectd-core
    state: present

- name: install collectd.conf
  template:
    src: collectd.conf.j2
    dest: /etc/collectd/collectd.conf
    mode: 0644
  notify: restart collectd

- name: create conf.d directory
  file:
    path: /etc/collectd/conf.d
    state: directory

- name: install common config
  template:
    src: common.conf.j2
    dest: /etc/collectd/conf.d/common.conf
    mode: 0644
  notify: restart collectd

- name: install plugin specific config
  loop: "{{ collectd_common_plugin_config | dict2items }}"
  loop_control:
    label: "{{ item.key }}"
  copy:
    dest: "/etc/collectd/conf.d/{{ item.key }}.conf"
    content: |
      <Plugin "{{ item.key }}">
        {{ item.value | indent(width=2) }}
      </Plugin>
  notify: restart collectd