Merge remote branch 'nico/master'

This commit is contained in:
Steven Armstrong 2011-06-14 07:58:34 +02:00
commit d21c52be1c
9 changed files with 149 additions and 19 deletions

View file

@ -355,15 +355,17 @@ __cdist_tmp_removal()
rm -rf "${__cdist_tmp_dir}" rm -rf "${__cdist_tmp_dir}"
} }
__cdist_exit_on_kill() # Does not work in children, will be called again in every script!
# Use only in interactive "front end" scripts
__cdist_kill_on_interrupt()
{ {
# FIXME: before 1.8.0 -> kill all children, but do not segfault
# kill 0
__cdist_tmp_removal __cdist_tmp_removal
kill 0
exit 1
} }
# Remove tempfiles at normal exit
trap __cdist_tmp_removal EXIT trap __cdist_tmp_removal EXIT
trap __cdist_exit_on_kill INT TERM
################################################################################ ################################################################################

View file

@ -25,6 +25,9 @@
[ $# -eq 1 ] || __cdist_usage "<target host>" [ $# -eq 1 ] || __cdist_usage "<target host>"
set -eu set -eu
# Kill children on interrupt - only in interactive scripts
trap __cdist_kill_on_interrupt INT TERM
__cdist_target_host="$1" __cdist_target_host="$1"
# Make target host available for non-core # Make target host available for non-core

View file

@ -25,18 +25,8 @@
[ $# -ge 1 ] || __cdist_usage "[-p] <target host> [target host ]" [ $# -ge 1 ] || __cdist_usage "[-p] <target host> [target host ]"
set -u set -u
# trap __cdist_tmp_removal EXIT # Kill children on interrupt - only in interactive scripts
trap killandclean EXIT trap __cdist_kill_on_interrupt INT TERM
killandclean()
{
__cdist_echo info "Existing and killing children..."
kill 0
# Ensure tmp stuff is being removed
__cdist_cleanly_exit
}
filter() filter()
{ {

View file

@ -0,0 +1,112 @@
Provisioning Server ideas
- bootup kernel on target host via TFTP/PXE
- start our code that
- enables networking (dhcp)
- enables sshd
Requires:
- Program that creates our blob that needs to be started
- for Linux: initrd
- Including ssh keys -> known!
- startup sshd
--------------------------------------------------------------------------------
Setup for installation server:
- have dhcpd available
- install tftpd server
- configure dhcp to tell clients to boot from tftp server
- have a kernel
--------------------------------------------------------------------------------
Ideas on how to create "blob"
- Use tools from system?
-> requires same arch on destination!
- Use debian|...| base?
-> works with cuni!
--------------------------------------------------------------------------------
tftp via cuni:
debian pxelinux.0 pxelinux.cfg
[19:44] kr:tftp% ln -s /usr/lib/syslinux/
--------------------------------------------------------------------------------
How to create the initrd?
Base from ...
arch?
debian?
- needs many hardware support / in kernel?
- fit to kernel?
--------------------------------------------------------------------------------
Based on Debian
[21:33] kr:tftp% sudo debootstrap --arch=i386 squeeze debian-squeeze
sudo chroot debian-squeeze /bin/bash
apt-get install openssh-server
--------------------------------------------------------------------------------
Based on Archlinux
Edit / create pacman.conf
Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
[21:40] kr:~% grep -v ^# pacman.conf | grep -v '^$'
[options]
HoldPkg = pacman glibc
SyncFirst = pacman
Architecture = auto
[core]
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
[extra]
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
[community]
Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686
[archlinuxfr]
Server = http://repo.archlinux.fr/$arch
[21:40] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot
[21:42] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot base
--------------------------------------------------------------------------------
Initramfs general:
- need /init
Test in Debian:
root@kr:/# ln -s /sbin/init init
Create initramfs:
[22:47] kr:debian-squeeze% sudo find . -print0 | sudo cpio --null -ov --format=newc | gzip -9 > ../pre-os/initrd.gz
--------------------------------------------------------------------------------
Gentoo: http://en.gentoo-wiki.com/wiki/Initramfs
It is possible to specify multiple initramfs to be extracted during boot. This can be useful if you want to create a generic initramfs (for example one that does mdadm) and then add modifications in separate files (for example a custom /etc/mdadm.conf for every machine).
http://syslinux.zytor.com/wiki/index.php/SYSLINUX#INITRD_initrd_file
It supports multiple filenames separated by commas. This is mostly useful for initramfs, which can be composed of multiple separate cpio or cpio.gz archives. Note: all files except the last one are zero-padded to a 4K page boundary. This should not affect initramfs.
--------------------------------------------------------------------------------
Multiple initrds, #1:
LABEL preos
MENU LABEL Pre OS (Debian Squeeze)
KERNEL debian-squeeze/boot/vmlinuz-2.6.32-5-686
INITRD debian-squeeze/boot/initrd.img-2.6.32-5-686,pre-os/initrd.gz
--------------------------------------------------------------------------------
Debug in rootfs:
root@kr:/# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
test
--------------------------------------------------------------------------------
Multiple nics in Debian...

View file

@ -0,0 +1,19 @@
How to make library functions available to manifest, explorer, etc.
Some ideas / background:
- do not have the user to source $__lib/foo if not needed
- have $__cdist_lib for internal stuff (probably referring to core/)
Implementation:
load_lib()
{
. $__cdist_lib/*
}
run_code_from_user()
{
load_lib
. file_from_user
}

View file

@ -37,6 +37,9 @@ CORE
-> add function to cdist-config, import from cdist-cache -> add function to cdist-config, import from cdist-cache
- check all all internal variables are prefixed with __cdist - check all all internal variables are prefixed with __cdist
- Define / document "this is what should be on host X"
and have it parsable by different (shinken) tool
-> given after manifest run already!
TYPES TYPES
------ ------

View file

@ -54,6 +54,7 @@ everybody using cdist, you're welcome to propose inclusion into upstream.
There are though some requirements to ensure your changes don't break others There are though some requirements to ensure your changes don't break others
work nor kill the authors brain: work nor kill the authors brain:
- All files should contain the usual header (Author, Copying, etc.)
- Code submission must be done via git - Code submission must be done via git
- Do not add conf/manifest/init - This file should only be touched in your - Do not add conf/manifest/init - This file should only be touched in your
private branch! private branch!

View file

@ -183,12 +183,12 @@ level tools like ruby installed. If a type requires specific tools to be present
on the target, there must be another type that provides this tool and the first on the target, there must be another type that provides this tool and the first
type should create an object of the specific type. type should create an object of the specific type.
If your type wants to save temporay data, that may be used by other types If your type wants to save temporary data, that may be used by other types
later on (for instance __file), you can save them in the subdirectory later on (for instance __file), you can save them in the subdirectory
"files" below $__object (but you must create it yourself). cdist will not touch "files" below $__object (but you must create it yourself). cdist will not touch
this directory. this directory.
If your type contains static files, it's also recommened to place them in If your type contains static files, it's also recommended to place them in
a folder named "files" within the type (again, because cdist guarantees to a folder named "files" within the type (again, because cdist guarantees to
never ever touch this folder). never ever touch this folder).

View file

@ -34,7 +34,7 @@ pull mechanism (client requests configuration).
SEE ALSO SEE ALSO
-------- --------
- Website: http://www.nico.schottelius.org/cdist/[] - Website: http://www.nico.schottelius.org/software/cdist/[]
- cdist-best-practise(7) - cdist-best-practise(7)
- cdist-deploy-to(1) - cdist-deploy-to(1)
- cdist-hacker(7) - cdist-hacker(7)