deprec 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/lib/deprec/recipes/collectd.rb +2 -2
- data/lib/deprec/recipes/haproxy.rb +103 -105
- data/lib/deprec/recipes/syslog.rb +2 -2
- data/lib/deprec/recipes/utils.rb +1 -1
- data/lib/deprec/recipes_minus_rails.rb +1 -1
- data/lib/deprec/templates/haproxy/haproxy-init.d +119 -0
- data/lib/deprec/templates/haproxy/haproxy.cfg.erb +42 -0
- data/lib/deprec/templates/nagios/objects/hosts.cfg.erb +15 -20
- metadata +4 -2
data/CHANGELOG
CHANGED
@@ -26,8 +26,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
26
26
|
|
27
27
|
# install dependencies for sysklogd
|
28
28
|
task :install_deps do
|
29
|
-
apt.install( {:base => %w(liboping-dev libperl-dev libdbi0-dev libesmtp-dev libganglia1-dev libmemcache-dev libnet1-dev libnotify-dev libopenipmi-dev liboping-dev libpcap-dev libperl-dev librrd2-dev libsensors-dev libstatgrab-dev
|
30
|
-
|
29
|
+
apt.install( {:base => %w(liboping-dev libcurl4-openssl-dev libperl-dev libdbi0-dev libesmtp-dev libganglia1-dev libmemcache-dev libnet1-dev libnotify-dev libopenipmi-dev liboping-dev libpcap-dev libperl-dev librrd2-dev libsensors-dev libstatgrab-dev libvirt-dev
|
30
|
+
rrdtool librrd2-dev librrds-perl libconfig-general-perl libhtml-parser-perl libregexp-common-perl)}, :stable )
|
31
31
|
end
|
32
32
|
|
33
33
|
SYSTEM_CONFIG_FILES[:collectd] = [
|
@@ -1,105 +1,103 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
#
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
# end
|
105
|
-
# end
|
1
|
+
# Copyright 2006-2009 by Mike Bailey. All rights reserved.
|
2
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
3
|
+
namespace :deprec do
|
4
|
+
namespace :haproxy do
|
5
|
+
|
6
|
+
SRC_PACKAGES[:haproxy] = {
|
7
|
+
:md5sum => "e37046e0cb2f407d92c41d7731d1dd10 haproxy-1.3.20.tar.gz",
|
8
|
+
:url => "http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.20.tar.gz"
|
9
|
+
}
|
10
|
+
|
11
|
+
desc "Install haproxy"
|
12
|
+
task :install do
|
13
|
+
install_deps
|
14
|
+
deprec2.download_src(SRC_PACKAGES[:haproxy], src_dir)
|
15
|
+
deprec2.install_from_src(SRC_PACKAGES[:haproxy], src_dir)
|
16
|
+
end
|
17
|
+
|
18
|
+
task :install_deps do
|
19
|
+
apt.install( {:base => %w(build-essential)}, :stable )
|
20
|
+
end
|
21
|
+
|
22
|
+
SYSTEM_CONFIG_FILES[:haproxy] = [
|
23
|
+
|
24
|
+
{:template => "haproxy.cfg.erb",
|
25
|
+
:path => '/etc/haproxy.cfg',
|
26
|
+
:mode => 0644,
|
27
|
+
:owner => 'root:root'},
|
28
|
+
|
29
|
+
{:template => "haproxy-init.d",
|
30
|
+
:path => '/etc/init.d/haproxy',
|
31
|
+
:mode => 0755,
|
32
|
+
:owner => 'root:root'}
|
33
|
+
|
34
|
+
]
|
35
|
+
|
36
|
+
PROJECT_CONFIG_FILES[:haproxy] = [
|
37
|
+
|
38
|
+
# {:template => "example.conf.erb",
|
39
|
+
# :path => 'conf/example.conf',
|
40
|
+
# :mode => 0755,
|
41
|
+
# :owner => 'root:root'}
|
42
|
+
]
|
43
|
+
|
44
|
+
desc "Generate configuration files for haproxy from template(s)"
|
45
|
+
task :config_gen do
|
46
|
+
config_gen_system
|
47
|
+
config_gen_project
|
48
|
+
end
|
49
|
+
|
50
|
+
task :config_gen_system do
|
51
|
+
SYSTEM_CONFIG_FILES[:haproxy].each do |file|
|
52
|
+
deprec2.render_template(:haproxy, file)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
task :config_gen_project do
|
57
|
+
PROJECT_CONFIG_FILES[:haproxy].each do |file|
|
58
|
+
deprec2.render_template(:haproxy, file)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc 'Deploy configuration filess for haproxy'
|
63
|
+
task :config, :roles => :haproxy do
|
64
|
+
config_system
|
65
|
+
config_project
|
66
|
+
end
|
67
|
+
|
68
|
+
task :config_system, :roles => :haproxy do
|
69
|
+
deprec2.push_configs(:haproxy, SYSTEM_CONFIG_FILES[:haproxy])
|
70
|
+
end
|
71
|
+
|
72
|
+
task :config_project, :roles => :haproxy do
|
73
|
+
deprec2.push_configs(:haproxy, PROJECT_CONFIG_FILES[:haproxy])
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
task :start, :roles => :haproxy do
|
78
|
+
run "#{sudo} /etc/init.d/haproxy start"
|
79
|
+
end
|
80
|
+
|
81
|
+
task :stop, :roles => :haproxy do
|
82
|
+
run "#{sudo} /etc/init.d/haproxy stop"
|
83
|
+
end
|
84
|
+
|
85
|
+
task :restart, :roles => :haproxy do
|
86
|
+
run "#{sudo} /etc/init.d/haproxy restart"
|
87
|
+
end
|
88
|
+
|
89
|
+
task :reload, :roles => :haproxy do
|
90
|
+
run "#{sudo} /etc/init.d/haproxy reload"
|
91
|
+
end
|
92
|
+
|
93
|
+
task :activate, :roles => :haproxy do
|
94
|
+
run "#{sudo} update-rc.d haproxy defaults"
|
95
|
+
end
|
96
|
+
|
97
|
+
task :deactivate, :roles => :haproxy do
|
98
|
+
run "#{sudo} update-rc.d -f haproxy remove"
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -23,7 +23,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
23
23
|
:owner => 'root:root'},
|
24
24
|
|
25
25
|
{ :template => 'syslogd.erb',
|
26
|
-
:path => '/etc/
|
26
|
+
:path => '/etc/default/syslogd',
|
27
27
|
:mode => 0644,
|
28
28
|
:owner => 'root:root'}
|
29
29
|
|
@@ -60,4 +60,4 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
data/lib/deprec/recipes/utils.rb
CHANGED
@@ -47,7 +47,7 @@ require "#{File.dirname(__FILE__)}/recipes/nagios"
|
|
47
47
|
require "#{File.dirname(__FILE__)}/recipes/collectd"
|
48
48
|
require "#{File.dirname(__FILE__)}/recipes/syslog"
|
49
49
|
require "#{File.dirname(__FILE__)}/recipes/heartbeat"
|
50
|
-
|
50
|
+
require "#{File.dirname(__FILE__)}/recipes/haproxy"
|
51
51
|
|
52
52
|
require "#{File.dirname(__FILE__)}/recipes/ubuntu"
|
53
53
|
require "#{File.dirname(__FILE__)}/recipes/lvm"
|
@@ -0,0 +1,119 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
### BEGIN INIT INFO
|
3
|
+
# Provides: haproxy
|
4
|
+
# Required-Start: $local_fs $network
|
5
|
+
# Required-Stop: $local_fs
|
6
|
+
# Default-Start: 2 3 4 5
|
7
|
+
# Default-Stop: 0 1 6
|
8
|
+
# Short-Description: fast and reliable load balancing reverse proxy
|
9
|
+
# Description: This file should be used to start and stop haproxy.
|
10
|
+
### END INIT INFO
|
11
|
+
|
12
|
+
# Author: Arnaud Cornet <acornet@debian.org>
|
13
|
+
|
14
|
+
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
15
|
+
PIDFILE=/var/run/haproxy.pid
|
16
|
+
HAPROXY=/usr/local/sbin/haproxy
|
17
|
+
CONFIG=/etc/haproxy.cfg
|
18
|
+
EXTRAOPTS=
|
19
|
+
ENABLED=1
|
20
|
+
|
21
|
+
test -x $HAPROXY || exit 0
|
22
|
+
test -f "$CONFIG" || exit 0
|
23
|
+
|
24
|
+
if [ -e /etc/default/haproxy ]; then
|
25
|
+
. /etc/default/haproxy
|
26
|
+
fi
|
27
|
+
|
28
|
+
test "$ENABLED" != "0" || exit 0
|
29
|
+
|
30
|
+
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
31
|
+
. /lib/lsb/init-functions
|
32
|
+
|
33
|
+
|
34
|
+
haproxy_start()
|
35
|
+
{
|
36
|
+
start-stop-daemon --start --pidfile "$PIDFILE" \
|
37
|
+
--exec $HAPROXY -- -f "$CONFIG" -D -p "$PIDFILE" \
|
38
|
+
$EXTRAOPTS || return 2
|
39
|
+
return 0
|
40
|
+
}
|
41
|
+
|
42
|
+
haproxy_stop()
|
43
|
+
{
|
44
|
+
start-stop-daemon --stop --user root --pidfile "$PIDFILE" \
|
45
|
+
|| return 2
|
46
|
+
return 0
|
47
|
+
}
|
48
|
+
|
49
|
+
haproxy_reload()
|
50
|
+
{
|
51
|
+
$HAPROXY -f "$CONFIG" -p $PIDFILE -D $EXTRAOPTS -st $(<$PIDFILE) \
|
52
|
+
|| return 2
|
53
|
+
return 0
|
54
|
+
}
|
55
|
+
|
56
|
+
case "$1" in
|
57
|
+
start)
|
58
|
+
log_daemon_msg "Starting haproxy" "haproxy"
|
59
|
+
haproxy_start
|
60
|
+
case "$?" in
|
61
|
+
0)
|
62
|
+
log_end_msg 0
|
63
|
+
;;
|
64
|
+
1)
|
65
|
+
log_end_msg 1
|
66
|
+
echo "pid file '$PIDFILE' found, haproxy not started."
|
67
|
+
;;
|
68
|
+
2)
|
69
|
+
log_end_msg 1
|
70
|
+
;;
|
71
|
+
esac
|
72
|
+
;;
|
73
|
+
stop)
|
74
|
+
log_daemon_msg "Stopping haproxy" "haproxy"
|
75
|
+
haproxy_stop
|
76
|
+
case "$?" in
|
77
|
+
0|1)
|
78
|
+
log_end_msg 0
|
79
|
+
;;
|
80
|
+
2)
|
81
|
+
log_end_msg 1
|
82
|
+
;;
|
83
|
+
esac
|
84
|
+
;;
|
85
|
+
reload|force-reload)
|
86
|
+
log_daemon_msg "Reloading haproxy" "haproxy"
|
87
|
+
haproxy_reload
|
88
|
+
case "$?" in
|
89
|
+
0|1)
|
90
|
+
log_end_msg 0
|
91
|
+
;;
|
92
|
+
2)
|
93
|
+
log_end_msg 1
|
94
|
+
;;
|
95
|
+
esac
|
96
|
+
;;
|
97
|
+
restart)
|
98
|
+
log_daemon_msg "Restarting haproxy" "haproxy"
|
99
|
+
haproxy_stop
|
100
|
+
haproxy_start
|
101
|
+
case "$?" in
|
102
|
+
0)
|
103
|
+
log_end_msg 0
|
104
|
+
;;
|
105
|
+
1)
|
106
|
+
log_end_msg 1
|
107
|
+
;;
|
108
|
+
2)
|
109
|
+
log_end_msg 1
|
110
|
+
;;
|
111
|
+
esac
|
112
|
+
;;
|
113
|
+
*)
|
114
|
+
echo "Usage: /etc/init.d/haproxy {start|stop|reload|restart}"
|
115
|
+
exit 3
|
116
|
+
;;
|
117
|
+
esac
|
118
|
+
|
119
|
+
:
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# /etc/haproxy.cfg
|
2
|
+
#
|
3
|
+
# Reload gracelly with:
|
4
|
+
#
|
5
|
+
# haproxy -f /etc/haproxy.conf -sf `cat /var/run/haproxy.pid`
|
6
|
+
#
|
7
|
+
global
|
8
|
+
log /var/log/haproxy.log daemon info
|
9
|
+
maxconn 4096
|
10
|
+
pidfile /var/run/haproxy.pid
|
11
|
+
daemon
|
12
|
+
|
13
|
+
defaults
|
14
|
+
option forwardfor
|
15
|
+
stats enable
|
16
|
+
stats auth myuser:mypass
|
17
|
+
balance roundrobin
|
18
|
+
option httpclose
|
19
|
+
mode http
|
20
|
+
retries 3
|
21
|
+
option redispatch
|
22
|
+
maxconn 2000
|
23
|
+
contimeout 5000
|
24
|
+
clitimeout 50000
|
25
|
+
srvtimeout 50000
|
26
|
+
|
27
|
+
frontend dell *:80
|
28
|
+
acl host_xenium hdr_beg(host) -i xenium.example.com
|
29
|
+
acl host_xenium hdr_beg(host) -i x.example.com
|
30
|
+
|
31
|
+
acl host_app1 hdr_beg(host) -i intrepica.com
|
32
|
+
acl host_app1 hdr_beg(host) -i www.intrepica.com
|
33
|
+
|
34
|
+
use_backend localhost if host_xenium
|
35
|
+
use_backend app1 if host_app1
|
36
|
+
|
37
|
+
backend localhost
|
38
|
+
server LOCALHOST 127.0.0.1:81
|
39
|
+
|
40
|
+
backend app1
|
41
|
+
server APP1 192.168.0.179:80
|
42
|
+
|
@@ -10,11 +10,6 @@ define hostgroup{
|
|
10
10
|
hostgroup_name servers
|
11
11
|
}
|
12
12
|
|
13
|
-
define hostgroup{
|
14
|
-
hostgroup_name linux-servers ; The name of the hostgroup
|
15
|
-
alias Linux Servers ; Long name of the group
|
16
|
-
}
|
17
|
-
|
18
13
|
define hostgroup{
|
19
14
|
hostgroup_name app
|
20
15
|
}
|
@@ -49,28 +44,28 @@ define hostgroup{
|
|
49
44
|
###############################################################################
|
50
45
|
|
51
46
|
define host{
|
52
|
-
use
|
47
|
+
use server ; Name of host template to use
|
53
48
|
; This host definition will inherit all variables that are defined
|
54
49
|
; in (or inherited by) the linux-server host template definition.
|
55
50
|
host_name localhost
|
56
|
-
hostgroups
|
51
|
+
hostgroups servers
|
57
52
|
alias localhost
|
58
53
|
address 127.0.0.1
|
59
54
|
}
|
60
55
|
|
61
|
-
define host {
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
67
|
-
|
68
|
-
define host {
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
}
|
56
|
+
# define host {
|
57
|
+
# use server
|
58
|
+
# host_name app01
|
59
|
+
# hostgroups servers,app
|
60
|
+
# address app01
|
61
|
+
# }
|
62
|
+
#
|
63
|
+
# define host {
|
64
|
+
# use server
|
65
|
+
# host_name app02
|
66
|
+
# hostgroups servers,app
|
67
|
+
# address app02
|
68
|
+
# }
|
74
69
|
|
75
70
|
###############################################################################
|
76
71
|
###############################################################################
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deprec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bailey
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-25 00:00:00 +10:00
|
13
13
|
default_executable: depify
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -106,6 +106,8 @@ files:
|
|
106
106
|
- lib/deprec/templates/ddclient/ddclient.conf.erb
|
107
107
|
- lib/deprec/templates/ddclient/ddclient.erb
|
108
108
|
- lib/deprec/templates/deprec/caprc.erb
|
109
|
+
- lib/deprec/templates/haproxy/haproxy-init.d
|
110
|
+
- lib/deprec/templates/haproxy/haproxy.cfg.erb
|
109
111
|
- lib/deprec/templates/heartbeat/authkeys.erb
|
110
112
|
- lib/deprec/templates/heartbeat/ha.cf.erb
|
111
113
|
- lib/deprec/templates/heartbeat/haresources.erb
|