Ensure Netdata service is enabled and started
This commit is contained in:
parent
9fc3a461ce
commit
f430743161
|
@ -5,3 +5,4 @@
|
||||||
* Install Netdata.
|
* Install Netdata.
|
||||||
* Can choose to install recommends packages.
|
* Can choose to install recommends packages.
|
||||||
* Manage Netdata configuration (/etc).
|
* Manage Netdata configuration (/etc).
|
||||||
|
* Ensure Netdata service is enabled and started.
|
||||||
|
|
|
@ -18,6 +18,8 @@ A role to manage Netdata installation and configuration.
|
||||||
* **netdata__install_recommends** : If recommends packages should be install [default : `True`].
|
* **netdata__install_recommends** : If recommends packages should be install [default : `True`].
|
||||||
* **netdata__deploy_state** : The desired state this role should achieve. [default : `present`].
|
* **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`].
|
* **netdata__etc_src** : Directory used as source to templating /etc/netdata configuration content [default : `../templates/etc/netdata`].
|
||||||
|
* **netdata__service_name** : The service name to manage [default : `netdata`].
|
||||||
|
* **netdata__service_manage** : If the Netdata services should be managed [default : `True`].
|
||||||
|
|
||||||
## Example Playbook
|
## Example Playbook
|
||||||
|
|
||||||
|
@ -60,6 +62,7 @@ mynode.DOMAIN
|
||||||
This role will :
|
This role will :
|
||||||
* Install needed packages to provide `netdata` service.
|
* Install needed packages to provide `netdata` service.
|
||||||
* Manage Netdata configuration (/etc/netdata).
|
* Manage Netdata configuration (/etc/netdata).
|
||||||
|
* Ensure Netdata service is enabled and started.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,26 @@ netdata__install_recommends: True
|
||||||
#
|
#
|
||||||
netdata__deploy_state: 'present'
|
netdata__deploy_state: 'present'
|
||||||
# ]]]
|
# ]]]
|
||||||
|
# .. envvar:: netdata__service_name [[[
|
||||||
|
#
|
||||||
|
# The service name to manage.
|
||||||
|
#
|
||||||
|
netdata__service_name: 'netdata'
|
||||||
|
|
||||||
|
# ]]]
|
||||||
|
# .. envvar:: netdata__service_manage [[[
|
||||||
|
#
|
||||||
|
# If the Netdata service should be managed ? Possible options :
|
||||||
|
#
|
||||||
|
# ``True``
|
||||||
|
# Default. The service is started and enabled.
|
||||||
|
#
|
||||||
|
# ``False``
|
||||||
|
# The service is disabled from startup.
|
||||||
|
#
|
||||||
|
netdata__service_manage: True
|
||||||
|
|
||||||
|
# ]]]
|
||||||
# ]]]
|
# ]]]
|
||||||
# Configuration [[[
|
# Configuration [[[
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
# handlers file for netdata
|
||||||
|
- name: Restart Netdata service
|
||||||
|
service:
|
||||||
|
name: '{{ netdata__service_name }}'
|
||||||
|
state: '{{ "restarted" if (netdata__deploy_state | bool and
|
||||||
|
netdata__service_manage | bool) else "stopped" }}'
|
||||||
|
enabled: '{{ netdata__service_manage | bool }}'
|
||||||
|
#state: '{{ "restarted" if (netdata__deploy_state | bool and
|
||||||
|
#netdata__service_manage | bool) else omit }}'
|
|
@ -23,6 +23,7 @@
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
with_filetree: '{{ netdata__etc_src }}'
|
with_filetree: '{{ netdata__etc_src }}'
|
||||||
when: item.state == 'directory'
|
when: item.state == 'directory'
|
||||||
|
notify: ['Restart Netdata service']
|
||||||
|
|
||||||
- name: Generate Netdata configuration files
|
- name: Generate Netdata configuration files
|
||||||
template:
|
template:
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
mode: '{{ item.mode }}'
|
mode: '{{ item.mode }}'
|
||||||
with_filetree: '{{ netdata__etc_src }}'
|
with_filetree: '{{ netdata__etc_src }}'
|
||||||
when: item.state == 'file'
|
when: item.state == 'file'
|
||||||
|
notify: ['Restart Netdata service']
|
||||||
|
|
||||||
- name: Generate Netdata configuration symlinks
|
- name: Generate Netdata configuration symlinks
|
||||||
template:
|
template:
|
||||||
|
@ -42,3 +44,4 @@
|
||||||
force: true
|
force: true
|
||||||
with_filetree: '{{ netdata__etc_src }}'
|
with_filetree: '{{ netdata__etc_src }}'
|
||||||
when: item.state == 'link'
|
when: item.state == 'link'
|
||||||
|
notify: ['Restart Netdata service']
|
||||||
|
|
Loading…
Reference in New Issue