aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2007-10-31 21:56:33 +0000
committerMicah Anderson <micah@riseup.net>2007-10-31 21:56:33 +0000
commitacc4a53384b23e5a350c6b2087323161f254ace2 (patch)
tree4eb7f9f91b8dc989d50f4b38482279b18d960718 /manifests
parent284b50a1d07310c8c10f1c1f953d1e979762c476 (diff)
downloadpuppet-virtual-acc4a53384b23e5a350c6b2087323161f254ace2.tar.gz
puppet-virtual-acc4a53384b23e5a350c6b2087323161f254ace2.tar.bz2
clean up the vserver module more so it can be useful
Diffstat (limited to 'manifests')
-rw-r--r--manifests/vserver.pp64
1 files changed, 20 insertions, 44 deletions
diff --git a/manifests/vserver.pp b/manifests/vserver.pp
index 42c1fdf..d0236a6 100644
--- a/manifests/vserver.pp
+++ b/manifests/vserver.pp
@@ -1,57 +1,38 @@
-# virtual/vserver.pp -- manage vserver specifica
-# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
-# See LICENSE for the full license granted to you.
+# virtual/vserver.pp -- manage vservers
modules_dir{ "virtual/contexts": }
class vserver::host {
- package { [ 'util-vserver', debootstrap ]: ensure => installed, }
+ package {
+ "util-vserver":
+ ensure => "0.30.214-4~bpo.1";
+
+ debootstrap:
+ ensure => installed
+ }
file {
- "/usr/local/bin/build_vserver":
- source => "puppet://$servername/virtual/build_vserver",
- mode => 0755, owner => root, group => root,
- require => [ Package['util-vserver'], Package[debootstrap],
- # this comes from dbp module and is the most current puppet deb
- File["/var/lib/puppet/modules/dbp/puppet_current.deb"] ];
- "/etc/vservers/local-interfaces/":
- ensure => directory,
- mode => 0755, owner => root, group => root;
+ "/etc/vservers/local-interfaces/":
+ ensure => directory,
+ mode => 0755, owner => root, group => root;
}
}
-define vs_create($in_domain, $legacy = false) {
- $vs_name = $legacy ? { true => $name, false => $in_domain ? { '' => $name, default => "${name}.${in_domain}" } }
+define vs_create($vs_name = $name, $context = $context) {
case $vs_name { '': { fail ( "Cannot create VServer with empty name" ) } }
- case $legacy {
- true: {
- exec { "/usr/local/bin/build_vserver \"${vs_name}\" \"${in_domain}\"":
- creates => "/etc/vservers/${vs_name}",
- require => File["/usr/local/bin/build_vserver"],
- alias => "vs_create_${vs_name}"
- }
- }
- false: {
- exec { "/usr/local/bin/build_vserver \"${vs_name}\" \"\"":
- creates => "/etc/vservers/${vs_name}",
- require => File["/usr/local/bin/build_vserver"],
- alias => "vs_create_${vs_name}"
- }
- }
+ exec { "/usr/sbin/vserver ${vs_name} build -m debootstrap -- -d etch":
+ creates => "/etc/vservers/${vs_name}",
+ alias => "vs_create_${vs_name}"
}
}
# ensure: present, stopped, running
-define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false) {
- case $in_domain { '': {}
- default: { err("${fqdn}: vserver ${name} uses deprecated \$in_domain" ) }
- }
- $vs_name = $legacy ? { true => $name, false => $in_domain ? { '' => $name, default => "${name}.${in_domain}" } }
+define vserver($vs_name = $name, $ensure, $context, $mark = '') {
$if_dir = "/etc/vservers/${vs_name}/interfaces/"
$mark_file = "/etc/vservers/${vs_name}/apps/init/mark"
@@ -59,9 +40,9 @@ define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false)
# TODO: wasn't there a syntax for using arrays as case selectors??
case $ensure {
- present: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, } }
- running: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, } }
- stopped: { vs_create{$name: in_domain => $in_domain, legacy => $legacy, } }
+ present: { vs_create{$name:} }
+ running: { vs_create{$name:} }
+ stopped: { vs_create{$name:} }
default: { err("${fqdn}: vserver(${vs_name}): unknown ensure '${ensure}'") }
}
@@ -86,8 +67,6 @@ define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false)
require => Exec["vs_create_${vs_name}"];
"/etc/vservers/${vs_name}/name":
content => "${vs_name}\n",
- # Changing this needs no restart
- # notify => Exec["vs_restart_${vs_name}"],
require => Exec["vs_create_${vs_name}"];
}
@@ -131,7 +110,7 @@ define vserver($ensure, $context, $in_domain = '', $mark = '', $legacy = false)
}
-# Changeing stuff with this define won't do much good, since it relies on
+# Changing stuff with this define won't do much good, since it relies on
# restarting the vservers to do the work, which won't clean up orphaned
# interfaces
define vs_interface($prefix = 24, $dev = '') {
@@ -182,9 +161,6 @@ define vs_ip_binding($vserver, $ip, $ensure) {
disconnected: {
file { "/etc/vservers/${vserver}/interfaces/${name}":
ensure => absent,
- # TODO: fix message:
- # warning: //ic/vs_ip[mailman_00]/File[/etc/vservers/mailman/interfaces/mailman_00]: Exec[vserver mailman restart] still depend on me -- not deleting
- # notify => Exec["vs_restart_${vserver}"],
}
}
default: {