summaryrefslogtreecommitdiff
path: root/roles/monitoring/graphite/carbon/tasks/main.yml
blob: 174b2f7a37267f4dc2e0446252296401df6decce (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
- name: prepare storage volume for /var/lib/graphite
  when: graphite_carbon_cache_storage is defined
  vars:
    storage_volume: "{{ graphite_carbon_cache_storage | combine({'dest': '/var/lib/graphite'}) }}"
  include_role:
    name: "storage/{{ graphite_carbon_cache_storage.type }}/volume"

- name: instsall apt packages
  apt:
    name: graphite-carbon
    state: present

- name: configure carbon-cache receiver interfaces
  loop: "{{ graphite_carbon_cache_receivers | dict2items }}"
  loop_control:
    label: "{{ item.key }} = {{ item.value.interface }}"
  ini_file:
    path: /etc/carbon/carbon.conf
    section: cache
    option: "{{ item.key | upper }}_RECEIVER_INTERFACE"
    value: "{{ item.value.interface }}"
  notify: restart carbon-cache

- name: configure carbon-cache receiver ports
  loop: "{{ graphite_carbon_cache_receivers | dict2items }}"
  loop_control:
    label: "{{ item.key }} = {{ item.value.port }}"
  ini_file:
    path: /etc/carbon/carbon.conf
    section: cache
    option: "{{ item.key | upper }}_RECEIVER_PORT"
    value: "{{ item.value.port }}"
  notify: restart carbon-cache

- name: set carbon-cache query interface
  ini_file:
    path: /etc/carbon/carbon.conf
    section: cache
    option: CACHE_QUERY_INTERFACE
    value: "{{ graphite_carbon_cache.interface }}"
  notify: restart carbon-cache

- name: set carbon-cache query port
  ini_file:
    path: /etc/carbon/carbon.conf
    section: cache
    option: CACHE_QUERY_PORT
    value: "{{ graphite_carbon_cache.port }}"
  notify: restart carbon-cache

- name: configure storage schemas
  template:
    src: storage-schemas.conf.j2
    dest: /etc/carbon/storage-schemas.conf
  notify: restart carbon-cache