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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
class virtual::vserver::host($vdirbase = "/var/lib/vservers") {
include virtual
module_dir{ "virtual/contexts": }
# make sure we have the ability to query for lsbdistcodename
include lsb
$utilvserver_version = $lsbdistcodename ? {
etch => "0.30.216~r2772-6~bpo40+1",
lenny => latest,
default => latest,
}
package {
"util-vserver":
ensure => $utilvserver_version;
debootstrap:
ensure => installed
}
file {
"/etc/vservers":
ensure => directory,
require => Package["util-vserver"];
"/etc/vservers/local-interfaces":
ensure => directory,
mode => 0755,
owner => root,
group => root,
require => File["/etc/vservers"];
"/usr/local/bin/build_vserver":
source => "puppet:///modules/virtual/vserver/build_vserver",
mode => 0755,
owner => root,
group => root,
require => [ Package['util-vserver'], Package[debootstrap]];
"/etc/vservers/.defaults/vdirbase":
ensure => $vdirbase,
require => File[$vdirbase];
"$vdirbase":
ensure => directory,
mode => 000,
owner => root,
group => root;
# perhaps we should use hashify.
# but i'm commenting this out until we learn how to properly use in case we want to use it.
#"/etc/cron.daily/vserver-hashify":
# source => "puppet:///virtual/hashify.cron.daily",
# mode => 0755, owner => root, group => root;
}
# remove dummy interfaces on the host
file_line { modules_dummy:
path => "/etc/modules",
line => "^dummy",
ensure => absent,
}
# Remove these dummy interfaces, they are annoying and we dont need them
file {
"/etc/modprobe.d/local-dummy":
ensure => absent,
mode => 0644, owner => root, group => root;
}
# Setup some plugins if munin is enabled in the system
case $virtual_munin {
false: {}
default: {
file {
"/usr/local/share/munin-plugins/vserver_resources":
source => "puppet:///modules/virtual/munin/vserver_resources",
mode => 0755,
owner => root,
group => root;
"/usr/local/share/munin-plugins/vserver_cpu_":
source => "puppet:///modules/virtual/munin/vserver_cpu_",
mode => 0755,
owner => root,
group => root;
"/usr/local/share/munin-plugins/vserver_loadavg":
source => "puppet:///modules/virtual/munin/vserver_loadavg",
mode => 0755,
owner => root,
group => root;
}
}
}
# Setup some plugins if munin is enabled in the system
case $virtual_munin {
false: {}
default: {
# This creates a load average graph combining the individual load averages of each vserver on the host
munin::plugin {
"vserver_loadavg":
config => "user root\n",
script_path_in => "/usr/local/share/munin-plugins";
}
# This creates a RSS graph for each vserver on the host (note after more than 4 vservers this can get noisy)
munin::plugin {
"vserver_resources_RSS":
ensure => "vserver_resources",
config => "user root\nenv.resource RSS",
script_path_in => "/usr/local/share/munin-plugins";
}
# This creates a VM graph for each vserver on the host (note after more than 4 vservers this can get noisy)
munin::plugin {
"vserver_resources_VM":
ensure => "vserver_resources",
config => "user root\nenv.resource VM",
script_path_in => "/usr/local/share/munin-plugins";
}
# This creates a VM graph for each vserver on the host (note after more than 4 vservers this can get noisy)
munin::plugin {
"vserver_cpu_":
config => "user root\n",
script_path_in => "/usr/local/share/munin-plugins";
}
}
}
}
|