2018-07-26 17:02:22 +02:00
|
|
|
---
|
|
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
|
|
#
|
|
|
|
# tasks file for netdata
|
|
|
|
|
|
|
|
# Manage base system packages [[[1
|
|
|
|
- name: Ensure base packages are in there desired state
|
|
|
|
package:
|
2023-01-24 11:14:26 +01:00
|
|
|
name: '{{ netdata__base_packages | flatten }}'
|
2018-07-26 17:02:22 +02:00
|
|
|
state: '{{ "present" if (netdata__deploy_state == "present") else "absent" }}'
|
|
|
|
install_recommends: '{{ netdata__install_recommends | bool }}'
|
2019-02-27 13:35:12 +01:00
|
|
|
register: pkg_result
|
|
|
|
until: pkg_result is success
|
2018-07-26 17:02:22 +02:00
|
|
|
|
2018-07-26 17:46:10 +02:00
|
|
|
# Server Manage /etc configuration files [[[1
|
|
|
|
- name: Ensure Netdata directory structure exists
|
|
|
|
file:
|
|
|
|
path: '/etc/netdata/{{ item.path }}'
|
|
|
|
state: directory
|
|
|
|
owner: 'root'
|
|
|
|
group: 'netdata'
|
|
|
|
mode: '0755'
|
2018-08-06 14:54:42 +02:00
|
|
|
with_filetree:
|
|
|
|
- '{{ netdata__host_etc_src }}'
|
|
|
|
- '{{ netdata__group_etc_src }}'
|
|
|
|
- '{{ netdata__etc_src }}'
|
|
|
|
- '{{ netdata__default_etc_src }}'
|
2018-08-03 09:01:44 +02:00
|
|
|
when: (item.state == 'directory') and (netdata__deploy_state == "present")
|
2018-07-26 18:09:35 +02:00
|
|
|
notify: ['Restart Netdata service']
|
2018-07-26 17:46:10 +02:00
|
|
|
|
|
|
|
- name: Generate Netdata configuration files
|
|
|
|
template:
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
dest: "/etc/netdata/{{ item.path | replace('.j2','') }}"
|
|
|
|
owner: 'root'
|
|
|
|
group: 'netdata'
|
|
|
|
mode: '{{ item.mode }}'
|
2018-08-06 14:54:42 +02:00
|
|
|
with_filetree:
|
|
|
|
- '{{ netdata__host_etc_src }}'
|
|
|
|
- '{{ netdata__group_etc_src }}'
|
|
|
|
- '{{ netdata__etc_src }}'
|
|
|
|
- '{{ netdata__default_etc_src }}'
|
2018-08-03 09:01:44 +02:00
|
|
|
when: (item.state == 'file') and (netdata__deploy_state == "present")
|
2018-07-26 18:09:35 +02:00
|
|
|
notify: ['Restart Netdata service']
|
2018-07-26 17:46:10 +02:00
|
|
|
|
|
|
|
- name: Generate Netdata configuration symlinks
|
|
|
|
template:
|
|
|
|
src: '{{ item.src }}'
|
|
|
|
dest: "/etc/netdata/{{ item.path | replace('.j2','') }}"
|
|
|
|
state: 'link'
|
|
|
|
force: true
|
2018-08-06 14:54:42 +02:00
|
|
|
with_filetree:
|
|
|
|
- '{{ netdata__host_etc_src }}'
|
|
|
|
- '{{ netdata__group_etc_src }}'
|
|
|
|
- '{{ netdata__etc_src }}'
|
|
|
|
- '{{ netdata__default_etc_src }}'
|
2018-08-03 09:01:44 +02:00
|
|
|
when: (item.state == 'link') and (netdata__deploy_state == "present")
|
2018-07-26 18:09:35 +02:00
|
|
|
notify: ['Restart Netdata service']
|