1 - name: Run specific tasks
2 include_tasks: "{{ item.specific_task_file }}"
3 when: item.specific_task_file is defined
4 loop: "{{ netdata_extra_config }}"
6 - name: Configure plugins apt dependencies
8 name: "{{ netdata_plugins_apt }}"
11 netdata_plugins_apt: "{{ netdata_extra_config | map(attribute='apt_dependencies') |
12 reject('undefined') | list | flatten | unique }}"
13 register: netdata_plugins_apt_deps_st
14 until: netdata_plugins_apt_deps_st is succeeded
16 - name: Get list of pip dependencies
18 netdata_plugins_pip: "{{ netdata_extra_config | map(attribute='pip_dependencies') |
19 reject('undefined') | list | flatten | unique }}"
21 - name: Install pip for python dependencies
23 name: "{{ python_package }}"
26 - netdata_plugins_pip|length > 0
27 - ansible_os_family == 'Debian'
29 python_package: "{{ netdata_pip_package[ansible_distribution ~ ansible_distribution_version] | default('python-pip') }}"
30 register: netdata_pip_install
31 until: netdata_pip_install is succeeded
33 - name: Configure plugins pip dependencies
35 name: "{{ netdata_plugins_pip }}"
37 when: netdata_plugins_pip|length > 0
38 register: netdata_plugins_pip_deps_st
39 until: netdata_plugins_pip_deps_st is succeeded
41 - name: Add netdata to extra groups
44 groups: "{{ netdata_plugins_groups }}"
46 notify: restart netdata
48 netdata_plugins_groups: "{{ netdata_extra_config | map(attribute='extra_groups') |
49 reject('undefined') | list | flatten | unique }}"
51 - name: Get list of files to grant read on
53 netdata_plugins_files: "{{ netdata_extra_config | map(attribute='read_files') |
54 reject('undefined') | list | flatten | unique }}"
56 - name: Install acl if files need to be granted access
60 when: netdata_plugins_files|length > 0
62 - name: Grant read access to files
69 notify: restart netdata
70 loop: "{{ netdata_plugins_files }}"
72 - name: Configure plugins
74 dest: "{{ netdata_collector_conf_dir }}/{{ collector.name }}.conf"
75 content: "{{ content[collector.format | default('yaml')] }}"
78 when: collector.config is defined
79 notify: restart netdata
80 loop: "{{ netdata_extra_config }}"
83 label: "{{ collector.name }}"
85 netdata_collector_conf_dir: "{{ netdata_prefix }}/etc/netdata/{{ collector.type }}.d"
86 bash_content_tmp: "{{ collector.config.items() | sort | list | map('join','=') | list }}"
87 bash_content: "{{ bash_content_tmp | map('regex_replace','(.*)=(.*)',collector.name ~ '_\\1=\\2') | join('\n') }}"
88 yaml_content: "{{ collector.config | to_nice_yaml }}"
89 json_content: "{{ collector.config | to_nice_json }}"
91 bash: "{{ bash_content ~ '\n' }}"
92 json: "{{ json_content }}"
93 yaml: "{{ yaml_content }}"
94 no_log: "{{ collector.no_log | default(false) }}"
96 - name: Remove old config
98 path: "{{ netdata_old_collector_conf_dir }}/{{ collector.name }}.conf"
100 when: collector.replace is defined
101 notify: restart netdata
102 loop: "{{ netdata_extra_config }}"
105 label: "{{ collector.name }}"
107 netdata_old_collector_conf_dir: "{{ netdata_prefix }}/etc/netdata/{{ collector.replace }}.d"
109 - name: Configure chart
111 dest: "{{ netdata_collector_chart_dir }}"
112 src: "{{ collector.chart_name }}.chart.sh"
115 when: collector.chart_name is defined
116 notify: restart netdata
117 loop: "{{ netdata_extra_config }}"
120 label: "{{ collector.name }}"
122 netdata_collector_chart_dir: "{{ netdata_prefix }}/usr/libexec/netdata/charts.d/"
124 - name: Configure plugins health
126 dest: "{{ netdata_health_conf_dir }}/{{ collector.name }}.conf"
127 src: health_template.j2
130 when: collector.health_config is defined
131 notify: restart netdata # a reload would be enough
132 loop: "{{ netdata_extra_config }}"
135 label: "{{ collector.name }}"
137 - name: Configure overrides
139 dest: "{{ netdata_health_conf_dir }}/{{ override.name }}.conf"
141 # {{ override.name }}
142 {{ override.override }}
145 notify: reload netdata
146 loop: "{{ netdata_alarms_overrides }}"
149 label: "{{ override.name }}"
151 - name: Configure alarm
153 dest: "{{ netdata_health_conf_dir }}/{{ collector.name }}.conf"
154 src: "netdata_alarm.conf.j2"
157 when: collector.alarm_config is defined
158 notify: restart netdata
159 loop: "{{ netdata_extra_config }}"
162 label: "{{ collector.name }}"