Created
June 4, 2012 15:49
-
-
Save smoser/2869152 to your computer and use it in GitHub Desktop.
cobbler setup for automated installation 12.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bdir=/archive/local/cobbler | |
pydir=/usr/share/pyshared/cobbler/utils/; | |
snipdir=/var/lib/cobbler/snippets/ | |
mkdir -p $pydir | |
for f in $bdir/snippets/*; do ln -sf $f $snipdir/${f##*/}; done | |
for f in $bdir/pyshared/*; do ln -sf $f $pydir/${f##*/}; done | |
for p in precise-i386 precise-x86_64; do | |
sudo cobbler profile add --name smlocal-$p --parent=$p --kickstart=$bdir/kickstarts/smlocal.preseed; | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from base64 import b64encode, b64decode | |
from cStringIO import StringIO | |
from gzip import GzipFile | |
_LATE_COMMAND_TEMPLATE = ( | |
"in-target sh -c '" | |
"f=$1; " | |
"shift; " | |
"echo $0 | base64 --decode | gunzip > $f " | |
"&& chmod u+x $f " | |
"&& $f $* > $f.output 2>&1" | |
"' %s /root/%s-late-command") | |
def base64_gzip(content): | |
gzipped = StringIO() | |
gzip_file = GzipFile(fileobj=gzipped, mode="wb", compresslevel=9) | |
gzip_file.write(content) | |
gzip_file.close() | |
return b64encode(gzipped.getvalue()) | |
def run_late_in_target(command, name="noname"): | |
return _LATE_COMMAND_TEMPLATE % (base64_gzip(command), name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ubuntu Server Quick Install | |
# by Dustin Kirkland <[email protected]> | |
# * Documentation: http://bit.ly/uquick-doc | |
d-i debian-installer/locale string en_US.UTF-8 | |
d-i debian-installer/splash boolean false | |
d-i console-setup/ask_detect boolean false | |
d-i console-setup/layoutcode string us | |
d-i console-setup/variantcode string | |
d-i netcfg/get_nameservers string | |
d-i netcfg/get_ipaddress string | |
d-i netcfg/get_netmask string 255.255.255.0 | |
d-i netcfg/get_gateway string | |
d-i netcfg/confirm_static boolean true | |
d-i clock-setup/utc boolean true | |
d-i partman-auto/method string regular | |
d-i partman-lvm/device_remove_lvm boolean true | |
d-i partman-lvm/confirm boolean true | |
d-i partman/confirm_write_new_label boolean true | |
d-i partman/choose_partition select Finish partitioning and write changes to disk | |
d-i partman/confirm boolean true | |
d-i partman/confirm_nooverwrite boolean true | |
d-i partman/default_filesystem string ext3 | |
d-i clock-setup/utc boolean true | |
d-i clock-setup/ntp boolean true | |
d-i clock-setup/ntp-server string ntp.ubuntu.com | |
d-i base-installer/kernel/image string linux-server | |
d-i passwd/root-login boolean false | |
d-i passwd/make-user boolean true | |
d-i passwd/user-fullname string ubuntu | |
d-i passwd/username string ubuntu | |
# this password is 'ubuntu' | |
d-i passwd/user-password-crypted password $6$.1eHH0iY$ArGzKX2YeQ3G6U.mlOO3A.NaL22Ewgz8Fi4qqz.Ns7EMKjEJRIW2Pm/TikDptZpuu7I92frytmk5YeL.9fRY4. | |
d-i passwd/user-uid string | |
d-i user-setup/allow-password-weak boolean false | |
d-i user-setup/encrypt-home boolean false | |
d-i passwd/user-default-groups string adm cdrom dialout lpadmin plugdev sambashare | |
d-i apt-setup/services-select multiselect security | |
d-i apt-setup/security_host string security.ubuntu.com | |
d-i apt-setup/security_path string /ubuntu | |
d-i debian-installer/allow_unauthenticated string false | |
d-i pkgsel/upgrade select safe-upgrade | |
d-i pkgsel/language-packs multiselect | |
d-i pkgsel/update-policy select none | |
d-i pkgsel/updatedb boolean true | |
d-i grub-installer/skip boolean false | |
d-i lilo-installer/skip boolean false | |
d-i grub-installer/only_debian boolean true | |
d-i grub-installer/with_other_os boolean true | |
d-i finish-install/keep-consoles boolean false | |
d-i finish-install/reboot_in_progress note | |
d-i cdrom-detect/eject boolean true | |
d-i debian-installer/exit/halt boolean false | |
d-i debian-installer/exit/poweroff boolean false | |
d-i pkgsel/include string openssh-server | |
d-i mirror/country string manual | |
d-i mirror/http/hostname string archive.ubuntu.com | |
d-i mirror/http/directory string /ubuntu | |
d-i mirror/http/proxy string http://nelson:3128/ | |
d-i preseed/late_command string true && \ | |
$SNIPPET('smlocal_disable_pxe') && \ | |
$SNIPPET('smlocal_late_command') \ | |
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget "http://$http_server:$http_port/cblr/svc/op/nopxe/system/$system_name" -O /dev/null \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import orchestra.utils.runcmd | |
$orchestra.utils.runcmd.run_late_in_target_file("/archive/local/cobbler/misc/smoser-late-command", "cobbler-late-command") \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## this file is read from /var/lib/cobbler/snippets/smoser_late_command | |
export LANG=C | |
#environment contains 'DEBIAN_HAS_FRONTEND=1' | |
unset DEBIAN_HAS_FRONTEND DEBIAN_FRONTEND DEBCONF_REDIR DEBCONF_OLD_FD_BASE | |
export DEBIAN_FRONTEND=noninteractive | |
echo 'Acquire { HTTP { Proxy "http://nelson:3128/"; }; };' >> /etc/apt/apt.conf.d/99smoser-home | |
echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/force-unsafe-io | |
apt-get update --assume-yes ; | |
apt-get dist-upgrade --assume-yes ; | |
apt-get install --assume-yes \ | |
bzr pastebinit ubuntu-dev-tools ccache bzr-builddeb vim-nox lftp \ | |
build-essential euca2ools cloud-utils python-software-properties \ | |
virt-host^ git-core byobu | |
( umask 226 && cat > /etc/sudoers.d/90-ubuntu-user ) <<EOF | |
# ubuntu gets passwordless sudo functionality. | |
ubuntu ALL=(ALL) NOPASSWD:ALL | |
EOF | |
sudo -Hu ubuntu sh <<"ENDEND" | |
mkdir ~/bin | |
cat >> ~/.profile <<"EOF" | |
export EDITOR=vi | |
export DEB_BUILD_OPTIONS=parallel=4 | |
export PATH=/usr/lib/ccache:$PATH | |
EOF | |
echo "set -o vi" >> ~/.bashrc | |
ssh-import-id smoser | |
ENDEND | |
adduser ubuntu kvm | |
adduser ubuntu libvirtd | |
#adduser ubuntu admin | |
# smoser | |
cat >>/etc/default/grub <<EOF | |
#smoser. no fancy boot. | |
GRUB_TIMEOUT=5 | |
unset GRUB_HIDDEN_TIMEOUT_QUIET | |
unset GRUB_HIDDEN_TIMEOUT | |
GRUB_TERMINAL_OUTPUT=console | |
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" | |
GRUB_GFXMODE=640x480 # not necessary, because TERMINAL_OUTPUT=console | |
GRUB_RECORDFAIL_TIMEOUT=10 | |
EOF | |
echo "==== date: $(date -R) ====" | |
echo "==== uptime: $(uptime) ====" | |
cat /proc/uptime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, This is very good preseed!
Where is orchestra.utils.runcmd library? I can't found in cobbler or python library.
Thanks.