aboutsummaryrefslogtreecommitdiffhomepage
path: root/tasks/main.yml
blob: ca849a3e52530f012fa33f2c7588a3b5047f34ce (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
57
58
59
60
61
62
63
64
65
66
67
---
- name: Install requirements (Debian family)
  apt:
    name: curl
    state: present
  when: ansible_os_family == 'Debian'

- name: Install requirements (Redhat family)
  yum:
    name: curl
    state: present
  when: ansible_os_family == 'RedHat'

- name: Check if netdata is installed
  command: "{{ prefix }}netdata -V"
  ignore_errors: true
  register: netdata_installed_st
  changed_when: false
  vars:
    prefix: "{{ netdata_prefix | ternary(netdata_prefix~'/bin/', '') }}"

- name: Uninstall netdata
  include: uninstall.yml
  when:
    - netdata_uninstall_before is defined
    - netdata_uninstall_before | bool

- name: Install netdata
  shell:
    cmd: bash <(curl -Ss https://my-netdata.io/{{ netdata_installer }}.sh) --dont-wait {{ netdata_install_options }}
  args:
    executable: /bin/bash
  when:
    - netdata_installed_st is failed or netdata_force_install or netdata_uninstall_before

- name: Configure netdata
  template:
    src: netdata.conf.j2
    dest: "{{ netdata_prefix }}/etc/netdata/netdata.conf"
    owner: root
    group: root
    mode: 0644
  notify: restart netdata

- name: Configure streaming
  template:
    src: stream.conf.j2
    dest: "{{ netdata_prefix }}/etc/netdata/stream.conf"
    owner: root
    group: netdata
    mode: 0640
  when:
    - netdata_streaming_configuration is defined
    - netdata_streaming_configuration | count > 0
  notify: restart netdata

- name: Configure netdata alarm notifications
  template:
    dest: "{{ netdata_prefix }}/etc/netdata/health_alarm_notify.conf"
    src: "health_alarm_notify.conf.j2"
    owner: netdata
    group: root
    mode: 0640
  when:
    - netdata_alarm_notify_configs is defined
    - netdata_alarm_notify_configs | count > 0
  notify: restart netdata