diff options
Diffstat (limited to 'files')
-rwxr-xr-x | files/build_vserver | 12 | ||||
-rwxr-xr-x | files/create_openvpn_interface | 10 | ||||
-rwxr-xr-x | files/destroy_openvpn_interface | 9 | ||||
-rw-r--r-- | files/modules_dir/.placeholder | 0 | ||||
-rw-r--r-- | files/xen/CentOS/sysconfig/xend | 11 | ||||
-rwxr-xr-x | files/xen/CentOS/sysconfig/xendomains | 137 |
6 files changed, 174 insertions, 5 deletions
diff --git a/files/build_vserver b/files/build_vserver index bf4b949..16f6528 100755 --- a/files/build_vserver +++ b/files/build_vserver @@ -1,13 +1,15 @@ #!/bin/bash NAME=$1 -DOMAIN=$2 - +CONTEXT=$2 +RELEASE = $3 +DEBOOTSTRAP_MIRROR = $4 # create basic vserver -vserver $NAME build -m debootstrap -- -d etch -m http://ftp.at.debian.org/debian +vserver $NAME build -m debootstrap -- -d $RELEASE -m $DEBOOTSTRAP_MIRROR # default settings echo $NAME >/etc/vservers/$NAME/uts/nodename +echo $CONTEXT >/etc/vservers/$NAME/context # copy in some some defaults TARGET=/etc/vservers/$NAME/vdir/ @@ -17,7 +19,7 @@ cp /etc/apt/{preferences,sources.list} $TARGET/etc/apt/ # this is needed so puppet can find the puppetmaster and creates the right # certificate grep -v $NAME /etc/hosts > $TARGET/etc/hosts -echo "127.0.0.1 $NAME.$DOMAIN $NAME" >> $TARGET/etc/hosts +echo "127.0.0.1 $NAME" >> $TARGET/etc/hosts mkdir -p $TARGET/var/lib/puppet/modules/dbp cp /var/lib/puppet/modules/dbp/puppet_current.deb $TARGET/var/lib/puppet/modules/dbp/ @@ -29,4 +31,4 @@ vserver $NAME exec apt-get -y install lsb-release iproute vserver $NAME exec dpkg --install var/lib/puppet/modules/dbp/puppet_current.deb vserver $NAME exec apt-get -fy install -echo "Please sign now: puppetca --sign $NAME.$DOMAIN" >&2 +echo "Please sign now: puppetca --sign $NAME" >&2 diff --git a/files/create_openvpn_interface b/files/create_openvpn_interface new file mode 100755 index 0000000..87d9144 --- /dev/null +++ b/files/create_openvpn_interface @@ -0,0 +1,10 @@ +#!/bin/bash + +DEV="$1" +SUBNET="$2" + +openvpn --mktun --dev "$DEV" +ip link set dev "$DEV" txqueuelen 100 +ifconfig "$DEV" "$SUBNET".1 pointopoint "$SUBNET".2 mtu 1500 +route add -net "$SUBNET".0 netmask 255.255.255.0 gw "$SUBNET".2 + diff --git a/files/destroy_openvpn_interface b/files/destroy_openvpn_interface new file mode 100755 index 0000000..aa89ed4 --- /dev/null +++ b/files/destroy_openvpn_interface @@ -0,0 +1,9 @@ +#!/bin/bash + +DEV="$1" +SUBNET="$2" + +route del -net "$SUBNET".0 netmask 255.255.255.0 gw "$SUBNET".2 +ifconfig "$DEV" down +openvpn --rmtun --dev "$DEV" + diff --git a/files/modules_dir/.placeholder b/files/modules_dir/.placeholder deleted file mode 100644 index e69de29..0000000 --- a/files/modules_dir/.placeholder +++ /dev/null diff --git a/files/xen/CentOS/sysconfig/xend b/files/xen/CentOS/sysconfig/xend new file mode 100644 index 0000000..d72f9ad --- /dev/null +++ b/files/xen/CentOS/sysconfig/xend @@ -0,0 +1,11 @@ +# NB. changing these requires a reboot. +# A simple 'xend restart' will not take effect + +# Log all hypervisor messages (cf xm dmesg) +#XENCONSOLED_LOG_HYPERVISOR=no + +# Log all guest console output (cf xm console) +#XENCONSOLED_LOG_GUESTS=no + +# Location to store guest & hypervisor logs +#XENCONSOLED_LOG_DIR=/var/log/xen/console diff --git a/files/xen/CentOS/sysconfig/xendomains b/files/xen/CentOS/sysconfig/xendomains new file mode 100755 index 0000000..00b9784 --- /dev/null +++ b/files/xen/CentOS/sysconfig/xendomains @@ -0,0 +1,137 @@ +## Path: System/xen +## Description: xen domain start/stop on boot +## Type: string +## Default: +# +# The xendomains script can send SysRq requests to domains on shutdown. +# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility +# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks +# of the domains ("s"). +# +XENDOMAINS_SYSRQ="" + +## Type: integer +## Default: 100000 +# +# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait +# (in microseconds) after each SysRq, so the domain has a chance to react. +# If you want to a quick'n'dirty shutdown via SysRq, you may want to set +# it to a relatively high value (1200000). +# +XENDOMAINS_USLEEP=100000 + +## Type: integer +## Default: 5000000 +# +# When creating a guest domain, it is sensible to allow a little time for it +# to get started before creating another domain or proceeding through the +# boot process. Without this, the booting guests will thrash the disk as they +# start up. This timeout (in microseconds) specifies the delay after guest +# domain creation. +# +XENDOMAINS_CREATE_USLEEP=5000000 + +## Type: string +## Default: "" +# +# Set this to a non-empty string if you want to migrate virtual machines +# on shutdown. The string will be passed to the xm migrate DOMID command +# as is: It should contain the target IP address of the physical machine +# to migrate to and optionally parameters like --live. Leave empty if +# you don't want to try virtual machine relocation on shutdown. +# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for +# that domain. +# +XENDOMAINS_MIGRATE="" + +## Type: string +## Default: /var/lib/xen/save +# +# Directory to save running domains to when the system (dom0) is +# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE +# is set (see below). Leave empty to disable domain saving on shutdown +# (e.g. because you rather shut domains down). +# If domain saving does succeed, SHUTDOWN will not be executed. +# +XENDOMAINS_SAVE= + +## Type: string +## Default: "--halt --wait" +# +# If neither MIGRATE nor SAVE were enabled or if they failed, you can +# try to shut down a domain by sending it a shutdown request. To do this, +# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting +# for the domain to be really down. Leave empty to skip domain shutdown. +# +XENDOMAINS_SHUTDOWN="--halt --wait" + +## Type: string +## Default: "--all --halt --wait" +# +# After we have gone over all virtual machines (resp. all automatically +# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq, +# migrated, saved and/or shutdown according to the settings above, we +# might want to shutdown the virtual machines that are still running +# for some reason or another. To do this, set this variable to +# "--all --halt --wait", it will be passed to xm shutdown. +# Leave it empty not to do anything special here. +# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY +# is set.) +# +XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait" + +## Type: boolean +## Default: true +# +# This variable determines whether saved domains from XENDOMAINS_SAVE +# will be restored on system startup. +# +XENDOMAINS_RESTORE=false + +## Type: string +## Default: /etc/xen/auto +# +# This variable sets the directory where domains configurations +# are stored that should be started on system startup automatically. +# Leave empty if you don't want to start domains automatically +# (or just don't place any xen domain config files in that dir). +# Note that the script tries to be clever if both RESTORE and AUTO are +# set: It will first restore saved domains and then only start domains +# in AUTO which are not running yet. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO=/etc/xen/auto + +## Type: boolean +## Default: false +# +# If this variable is set to "true", only the domains started via config +# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, +# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise +# all running domains will be. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO_ONLY=false + +## Type: integer +## Default: 300 +# +# On xendomains stop, a number of xm commands (xm migrate, save, shutdown, +# shutdown --all) may be executed. In the worst case, these commands may +# stall forever, which will prevent a successful shutdown of the machine. +# If this variable is non-zero, the script will set up a watchdog timer +# for every of these xm commands and time it out after the number of seconds +# specified by this variable. +# Note that SHUTDOWN_ALL will not be called if no virtual machines or only +# zombies are still running, so you don't need to enable this timeout just +# for the zombie case. +# The setting should be large enough to make sure that migrate/save/shutdown +# can succeed. If you do live migrations, keep in mind that live migration +# of a 1GB machine over Gigabit ethernet may actually take something like +# 100s (assuming that live migration uses 10% of the network # bandwidth). +# Depending on the virtual machine, a shutdown may also require a significant +# amount of time. So better setup this variable to a huge number and hope the +# watchdog never fires. +# +XENDOMAINS_STOP_MAXWAIT=300 + |