Manage Netdata configuration
This commit is contained in:
parent
e511b71706
commit
9fc3a461ce
|
@ -4,3 +4,4 @@
|
|||
### Features
|
||||
* Install Netdata.
|
||||
* Can choose to install recommends packages.
|
||||
* Manage Netdata configuration (/etc).
|
||||
|
|
29
README.md
29
README.md
|
@ -17,22 +17,49 @@ A role to manage Netdata installation and configuration.
|
|||
* **netdata__base_packages** : List of base packages in order to provide Netdata [default : `netdata`].
|
||||
* **netdata__install_recommends** : If recommends packages should be install [default : `True`].
|
||||
* **netdata__deploy_state** : The desired state this role should achieve. [default : `present`].
|
||||
* **netdata__etc_src** : Directory used as source to templating /etc/netdata configuration content [default : `../templates/etc/netdata`].
|
||||
|
||||
## Example Playbook
|
||||
|
||||
* Use defaults vars :
|
||||
|
||||
``` yaml
|
||||
- hosts: mynode.domain
|
||||
- hosts: mynode.DOMAIN
|
||||
roles:
|
||||
- role: ipr-cnrs.netdata
|
||||
tags: ['role::netdata', 'ipr']
|
||||
```
|
||||
|
||||
* Use your own Netdata's configuration as source :
|
||||
|
||||
``` yml
|
||||
- hosts: mynode.DOMAIN
|
||||
roles:
|
||||
- role: ipr-cnrs.netdata
|
||||
netdata__etc_src: '{{ inventory_dir + "/../resources/host/mynode.DOMAIN/etc/netdata/" }}'
|
||||
```
|
||||
|
||||
* Ensure your directory contains only templates or sub-directories, such as :
|
||||
|
||||
``` sh
|
||||
mynode.DOMAIN
|
||||
└── etc
|
||||
└── netdata
|
||||
├── fping.conf.j2
|
||||
├── health_alarm_notify.conf.j2
|
||||
├── netdata.conf.j2
|
||||
└── node.d
|
||||
├── named.conf.md.j2
|
||||
├── README.md.j2
|
||||
├── sma_webbox.conf.md.j2
|
||||
└── snmp.conf.md.j2
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
This role will :
|
||||
* Install needed packages to provide `netdata` service.
|
||||
* Manage Netdata configuration (/etc/netdata).
|
||||
|
||||
## Development
|
||||
|
||||
|
|
|
@ -37,3 +37,18 @@ netdata__install_recommends: True
|
|||
netdata__deploy_state: 'present'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# Configuration [[[
|
||||
# -----------------------------
|
||||
|
||||
# .. envvar:: netdata__etc_src [[[.
|
||||
# Directory with templates used to provide Netdata configuration (usually in
|
||||
# '/etc/netdata').
|
||||
#
|
||||
# Must be a relative path to default directory of this role
|
||||
# or to your ansible inventory directory.
|
||||
#
|
||||
netdata__etc_src: '../templates/etc/netdata'
|
||||
|
||||
# ]]]
|
||||
|
||||
# ]]]
|
||||
|
|
|
@ -13,3 +13,32 @@
|
|||
- '{{ 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'
|
||||
|
||||
- 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'
|
||||
|
||||
- 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'
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
## {{ ansible_managed }}
|
||||
|
||||
# NetData Configuration
|
||||
|
||||
# The current full configuration can be retrieved from the running
|
||||
# server at the URL
|
||||
#
|
||||
# http://localhost:19999/netdata.conf
|
||||
#
|
||||
# for example:
|
||||
#
|
||||
# wget -O /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
|
||||
#
|
||||
|
||||
[global]
|
||||
run as user = netdata
|
||||
web files owner = root
|
||||
web files group = root
|
||||
# Netdata is not designed to be exposed to potentially hostile
|
||||
# networks.See https://github.com/firehol/netdata/issues/164
|
||||
bind socket to IP = 127.0.0.1
|
Loading…
Reference in New Issue