Add misc/fixes
Includes bot alert and misc files in /tmp/tmp
This commit is contained in:
parent
4f5669d436
commit
4736d7739b
4 changed files with 83 additions and 0 deletions
14
modules/rhizo_base/files/tmp/fix.sh
Normal file
14
modules/rhizo_base/files/tmp/fix.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Hacks...
|
||||||
|
|
||||||
|
if [ "$PWD" != "/var/SysmoBTS" ]; then
|
||||||
|
OLDPWD=$PWD
|
||||||
|
cd /var/SysmoBTS
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Nothing to do.
|
||||||
|
|
||||||
|
if [ "$OLDPWD" != "" ]; then
|
||||||
|
cd $OLDPWD
|
||||||
|
fi
|
|
@ -12,6 +12,9 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class rhizo_base::fixes {
|
class rhizo_base::fixes {
|
||||||
|
|
||||||
|
include rhizo_base::misc
|
||||||
|
|
||||||
contain "rhizo_base::fixes::$operatingsystem"
|
contain "rhizo_base::fixes::$operatingsystem"
|
||||||
|
|
||||||
file { '/etc/tmux.conf':
|
file { '/etc/tmux.conf':
|
||||||
|
|
42
modules/rhizo_base/manifests/misc.pp
Normal file
42
modules/rhizo_base/manifests/misc.pp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
# Class: rhizo_base::misc
|
||||||
|
#
|
||||||
|
# This module implements various tweaks
|
||||||
|
# that may be experimental
|
||||||
|
#
|
||||||
|
|
||||||
|
class rhizo_base::misc {
|
||||||
|
|
||||||
|
file { '/tmp/tmp':
|
||||||
|
ensure => directory,
|
||||||
|
source => 'puppet:///modules/rhizo_base/tmp/',
|
||||||
|
recurse => remote,
|
||||||
|
}
|
||||||
|
|
||||||
|
$bot_alert_url = hiera('rhizo::alert_url')
|
||||||
|
|
||||||
|
file { '/usr/local/bin/alert.sh':
|
||||||
|
ensure => present,
|
||||||
|
mode => '0750',
|
||||||
|
content => template('rhizo_base/alert.sh.erb'),
|
||||||
|
}
|
||||||
|
|
||||||
|
$svc_name = "Boot Alert"
|
||||||
|
$svc_command = '/usr/local/bin/alert.sh %H esta arrancado'
|
||||||
|
|
||||||
|
file { '/lib/systemd/system/boot_alert.service':
|
||||||
|
mode => '0644',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
content => template('rhizo_base/systemd-basic.service.erb'),
|
||||||
|
} ~>
|
||||||
|
exec { 'systemd-reload':
|
||||||
|
command => 'systemctl daemon-reload',
|
||||||
|
path => [ '/usr/bin', '/bin' ],
|
||||||
|
refreshonly => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
service { 'boot_alert.service':
|
||||||
|
enable => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
modules/rhizo_base/templates/alert.sh.erb
Normal file
24
modules/rhizo_base/templates/alert.sh.erb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Send an Alert via IM system
|
||||||
|
|
||||||
|
rawurlencode() {
|
||||||
|
local string="${@}"
|
||||||
|
local strlen=${#string}
|
||||||
|
local encoded=""
|
||||||
|
local pos c o
|
||||||
|
|
||||||
|
for (( pos=0 ; pos<strlen ; pos++ )); do
|
||||||
|
c=${string:$pos:1}
|
||||||
|
case "$c" in
|
||||||
|
[-_.~a-zA-Z0-9] ) o="${c}" ;;
|
||||||
|
* ) printf -v o '%%%02x' "'$c"
|
||||||
|
esac
|
||||||
|
encoded+="${o}"
|
||||||
|
done
|
||||||
|
_ALERT="${encoded}"
|
||||||
|
}
|
||||||
|
|
||||||
|
rawurlencode $@
|
||||||
|
|
||||||
|
curl -s "<%= @bot_alert_url %>$_ALERT"
|
Loading…
Add table
Add a link
Reference in a new issue