48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
---
|
|
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
|
#
|
|
# tasks file for netdata
|
|
|
|
# Manage base system packages [[[1
|
|
- name: Ensure base packages are in there desired state
|
|
package:
|
|
name: '{{ item }}'
|
|
state: '{{ "present" if (netdata__deploy_state == "present") else "absent" }}'
|
|
install_recommends: '{{ netdata__install_recommends | bool }}'
|
|
with_flattened:
|
|
- '{{ netdata__base_packages }}'
|
|
|
|
|
|
# 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'
|
|
with_filetree: '{{ netdata__etc_src }}'
|
|
when: item.state == 'directory'
|
|
notify: ['Restart Netdata service']
|
|
|
|
- name: Generate Netdata configuration files
|
|
template:
|
|
src: '{{ item.src }}'
|
|
dest: "/etc/netdata/{{ item.path | replace('.j2','') }}"
|
|
owner: 'root'
|
|
group: 'netdata'
|
|
mode: '{{ item.mode }}'
|
|
with_filetree: '{{ netdata__etc_src }}'
|
|
when: item.state == 'file'
|
|
notify: ['Restart Netdata service']
|
|
|
|
- name: Generate Netdata configuration symlinks
|
|
template:
|
|
src: '{{ item.src }}'
|
|
dest: "/etc/netdata/{{ item.path | replace('.j2','') }}"
|
|
state: 'link'
|
|
force: true
|
|
with_filetree: '{{ netdata__etc_src }}'
|
|
when: item.state == 'link'
|
|
notify: ['Restart Netdata service']
|