aboutsummaryrefslogtreecommitdiff
path: root/manifests/vserver/host.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/vserver/host.pp')
-rw-r--r--manifests/vserver/host.pp134
1 files changed, 134 insertions, 0 deletions
diff --git a/manifests/vserver/host.pp b/manifests/vserver/host.pp
new file mode 100644
index 0000000..69718dd
--- /dev/null
+++ b/manifests/vserver/host.pp
@@ -0,0 +1,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
+ line { modules_dummy:
+ file => "/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";
+ }
+ }
+ }
+}