-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ansible install script and fix disk root image read error
- Loading branch information
fabian simon
committed
Nov 29, 2019
1 parent
00fe08e
commit b61ab80
Showing
184 changed files
with
30,143 additions
and
8,858 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
localhost ansible_ssh_user=root |
28 changes: 28 additions & 0 deletions
28
installing/ansibe/playbooks/funk_metric_agent/install_funk_metric_agent.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
- hosts: all | ||
vars_files: | ||
- vars/settings.yml | ||
tasks: | ||
- name: Create destination directory | ||
file: | ||
path: /usr/lokal/funk_metric_agent | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: Download binary {{ DOWNLOADURL }} | ||
get_url: | ||
url: "{{ DOWNLOADURL }}" | ||
dest: /usr/lokal/funk_metric_agent/funk_metric_agent_LINUX_{{ VERSION }} | ||
mode: '0755' | ||
|
||
- name: Copy init.d file | ||
template: | ||
src: ./funkmetricagent.j2 | ||
dest: /etc/init.d/funkmetricagent | ||
mode: '0755' | ||
|
||
- name: Enable service funkmetricagent, and start service | ||
service: | ||
name: funkmetricagent | ||
enabled: yes | ||
state: started |
67 changes: 67 additions & 0 deletions
67
installing/ansibe/playbooks/funk_metric_agent/templates/funkmetricagent.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: funk-metric-agent | ||
# Required-Start: $local_fs $network $named $time $syslog | ||
# Required-Stop: $local_fs $network $named $time $syslog | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Description: This is the systctl sctipt to start funk_metric_agent it was rollout with ansible so do not change by hand | ||
### END INIT INFO | ||
|
||
SCRIPT="/usr/lokal/funk_metric_agent/funk_metric_agent_LINUX_{{ VERSION }} --funkserver {{ FUNKSERVER }} --connectionkey {{ CONNECTIONKEY }} --searchindex={{ SEARCHINDEX }} {{ FUNK_ARGS }} &" | ||
RUNAS=root | ||
|
||
PIDFILE=/var/run/funk-metric-agent.pid | ||
LOGFILE=/var/log/funk-metric-agent.log | ||
|
||
start() { | ||
if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then | ||
echo 'Service already running' >&2 | ||
return 1 | ||
fi | ||
echo 'Starting service…' >&2 | ||
local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" | ||
su -c "$CMD" $RUNAS > "$PIDFILE" | ||
echo 'Service started' >&2 | ||
} | ||
|
||
stop() { | ||
if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then | ||
echo 'Service not running' >&2 | ||
return 1 | ||
fi | ||
echo 'Stopping service…' >&2 | ||
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" | ||
echo 'Service stopped' >&2 | ||
} | ||
|
||
uninstall() { | ||
echo -n "Are you really sure you want to uninstall this service? That cannot be undone. [yes|No] " | ||
local SURE | ||
read SURE | ||
if [ "$SURE" = "yes" ]; then | ||
stop | ||
rm -f "$PIDFILE" | ||
echo "Notice: log file is not be removed: '$LOGFILE'" >&2 | ||
update-rc.d -f funk-metric-agent remove | ||
rm -fv "$0" | ||
fi | ||
} | ||
|
||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
uninstall) | ||
uninstall | ||
;; | ||
restart) | ||
stop | ||
start | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop|restart|uninstall}" | ||
esac |
6 changes: 6 additions & 0 deletions
6
installing/ansibe/playbooks/funk_metric_agent/vars/settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
VERSION: 679 | ||
DOWNLOADURL: https://github.com/fasibio/funk-metric-agent/releases/download/refs%2Fheads%2F0.0.678/funk_metric_agent_LINUX_679 | ||
FUNK_ARGS: '' | ||
SEARCHINDEX: host | ||
FUNKSERVER: ws://localhost:3000 | ||
CONNECTIONKEY: changeMe04cf242924f6b5f96 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
- hosts: all | ||
|
||
- name: Install funk metric agent | ||
import_playbook: playbooks/funk_metric_agent/install_funk_metric_agent.yml host=all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.