Skip to content
Snippets Groups Projects
Commit bf53ec42 authored by jurgenhaas's avatar jurgenhaas
Browse files

New role NetData

parents
No related branches found
No related tags found
No related merge requests found
---
# file: roles/netdata/handlers/main.yml
- name: "Include NetData to Boot-List"
command: update-rc.d netdata defaults
- name: "Start NetData"
service:
name='netdata'
state='started'
---
# file: roles/netdata/tasks/main.yml
- name: "Install required packages"
apt:
pkg={{ item }}
state=installed
update_cache=yes
with_items:
- zlib1g-dev
- gcc
- make
- git
- autoconf
- autogen
- automake
- pkg-config
- name: "Clone NetData"
git:
accept_hostkey: true
repo: "https://github.com/firehol/netdata.git"
dest: "/opt/netdata"
force: yes
depth: 1
- name: "Install and configure NetData"
shell: ./netdata-installer.sh --dont-wait
args:
chdir: /opt/netdata
- name: "Install startup script"
template:
src=etc_init_d_netdata
dest=/etc/init.d/netdata
owner=root
group=root
mode=755
notify:
- "Include NetData to Boot-List"
- "Start NetData"
#!/bin/bash
# chkconfig: 345 99 01
# description: startup script
# Source functions
. /lib/lsb/init-functions
DAEMON="netdata"
DAEMON_PATH=/usr/sbin
PIDFILE=/var/run/$DAEMON.pid
DAEMONOPTS="-pidfile $PIDFILE"
STOP_TIMEOUT="10"
service_start()
{
printf "%-50s" "Starting $DAEMON..."
start_daemon $DAEMON_PATH/$DAEMON $DAEMONOPTS
echo
}
service_stop()
{
printf "%-50s" "Stopping $DAEMON..."
killproc -p ${PIDFILE} $DAEMON_PATH/$DAEMON
rm -f ${PIDFILE}
echo
}
service_status()
{
status_of_proc -p ${PIDFILE} $DAEMON_PATH/$DAEMON
}
case "$1" in
start)
service_start
;;
status)
service_status
;;
stop)
service_stop
;;
restart)
service_stop
service_start
;;
*)
echo "Usage: $0 {status|start|stop|restart}"
exit 1
esac
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment