Unattended installations

Version 19 (Paul Kelly, 03/23/2011 12:42 pm)

1 4 Ohad Levy
{{toc}}
2 4 Ohad Levy
3 1
h1. How do I use unattended installations (Kickstart, jumpstart, preseed)?
4 1
5 19 Paul Kelly
Foreman manages the host creation process by controlling a host's DHCP, DNS, TFTP boot file and the puppet node classification. This is whole process is handled in the core foreman program and in several satellite proxies running at various locations within the organization. More details can be found on the [[Foreman_Architecture]] page. 
6 1
7 19 Paul Kelly
Foreman automates network boot processes using PXEboot, gPXE, (or native Solaris net:dhcp in the future.) It also manages the host's DHCP and DNS entries as of version 0.2.
8 19 Paul Kelly
9 1
10 1
h2. TFTP
11 1
12 4 Ohad Levy
Foreman has currently limited support for TFTP- that means it require the TFTP server to be accessible via the local file system.
13 4 Ohad Levy
future versions of Foreman would allow remote TFTP servers as well.
14 1
15 1
make sure you add into your config/settings.yml
16 1
<pre> :tftppath: /var/lib/tftpboot/pxelinux.cfg</pre>
17 4 Ohad Levy
replace the value with your actual TFTP directory and ensure that the *user which executes Foreman  have write access*.
18 1
19 1
20 4 Ohad Levy
h3. How does Foreman manages TFTP?
21 1
22 4 Ohad Levy
When clicking on the Build button (in the host list), Foreman would generate a link which will be automatically read by pxelinux,
23 1
This link would point to a predefined syslinux(pxelinux) boot file which would be based on the Operating System used.
24 1
25 8 Matt Moran
Note:- if you require the link to point to different PXE files based on serial console variables, adding '0,19200n8' in the serial field of a host will create a different symbolic link.
26 7 Matt Moran
27 1
after a successful OS installation, that link will be removed, and your default PXE settings will be served.
28 4 Ohad Levy
The idea behind it is to set the boot order on each host to always boot from network, and then change the settings via Foreman.
29 1
30 11 Jochen Schalanda
This avoids the need to press F12 on each machine just to reinstall it, Clicking on Build in Foreman will trigger a host re-installation upon the next server reboot if default boot order is PXE.
31 1
32 11 Jochen Schalanda
*+Examples+*:
33 11 Jochen Schalanda
34 11 Jochen Schalanda
*CentOS 5 32bit*:
35 1
<pre>default linux
36 1
label linux
37 4 Ohad Levy
kernel boot/centos-5-32.vmlinuz
38 17 Ohad Levy
append initrd=boot/centos-5-32.initrd.img ks=http://foremanhost/unattended/kickstart ksdevice=bootif network kssendmac
39 1
</pre>
40 1
41 15 Jochen Schalanda
PXEboot kernels for CentOS:
42 15 Jochen Schalanda
* "CentOS 4 32bit":http://mirror.centos.org/centos/4/os/i386/images/pxeboot/
43 15 Jochen Schalanda
* "CentOS 4 64bit":http://mirror.centos.org/centos/4/os/x86_64/images/pxeboot/
44 15 Jochen Schalanda
* "CentOS 5 32bit":http://mirror.centos.org/centos/5/os/i386/images/pxeboot/
45 15 Jochen Schalanda
* "CentOS 5 64bit":http://mirror.centos.org/centos/5/os/x86_64/images/pxeboot/
46 15 Jochen Schalanda
47 16 Jochen Schalanda
PXEboot kernels for Fedora:
48 16 Jochen Schalanda
* "Fedora 12 32bit":http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/i386/os/images/pxeboot/
49 16 Jochen Schalanda
* "Fedora 12 64bit":http://download.fedoraproject.org/pub/fedora/linux/releases/12/Fedora/x86_64/os/images/pxeboot/
50 15 Jochen Schalanda
51 13 Jochen Schalanda
*Ubuntu 10.04 64bit*:
52 1
<pre>default preseed
53 1
label preseed
54 11 Jochen Schalanda
kernel ubuntu/lucid/x86_64/linux
55 11 Jochen Schalanda
append initrd=ubuntu/lucid/x86_64/initrd.gz ramdisk_size=10800 root=/dev/rd/0 rw auto interface=auto url=http://foreman.example.net/unattended/preseed hostname=unassigned-hostname locale=en_US console-setup/ask_detect=false console-setup/layout=USA console-setup/variant=USA DEBCONF_PRIORITY=critical</pre>
56 11 Jochen Schalanda
57 11 Jochen Schalanda
Tweakable options:
58 11 Jochen Schalanda
* @interface@: the network interface on which the DHCP client should run. Set to @auto@ for automatic detection or the specific interface (@eth0@, @eth1@, ...) if it doesn't work for you.
59 11 Jochen Schalanda
* @url@: The URL to the preseed file provided by Foreman.
60 11 Jochen Schalanda
* @locale@: The locale used during the installation.
61 11 Jochen Schalanda
* @log_host=loghost.example.com@ and @log_port=1234@ (if the syslogd doesn't listen on @514/udp@) if there is a central log host in your network.
62 1
63 15 Jochen Schalanda
Netboot kernels for Debian and Ubuntu:
64 14 Jochen Schalanda
* "Debian 5.0 (Lenny) 32bit":http://ftp.debian.org/debian/dists/lenny/main/installer-i386/current/images/netboot/debian-installer/i386/
65 14 Jochen Schalanda
* "Debian 5.0 (Lenny) 64bit":http://ftp.debian.org/debian/dists/lenny/main/installer-amd64/current/images/netboot/debian-installer/amd64/
66 12 Jochen Schalanda
* "Ubuntu 8.04 LTS (Hardy Heron) 32bit":http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/ubuntu-installer/i386/
67 12 Jochen Schalanda
* "Ubuntu 8.04 LTS (Hardy Heron) 64bit":http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/
68 12 Jochen Schalanda
* "Ubuntu 9.10 (Karmic Koala) 32bit":http://archive.ubuntu.com/ubuntu/dists/karmic/main/installer-i386/current/images/netboot/ubuntu-installer/i386/
69 12 Jochen Schalanda
* "Ubuntu 9.10 (Karmic Koala) 64bit":http://archive.ubuntu.com/ubuntu/dists/karmic/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/
70 12 Jochen Schalanda
* "Ubuntu 10.04 LTS (Lucid Lynx) 32bit":http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/ubuntu-installer/i386/
71 12 Jochen Schalanda
* "Ubuntu 10.04 LTS (Lucid Lynx) 64bit":http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/
72 12 Jochen Schalanda
73 12 Jochen Schalanda
74 1
75 3 Ohad Levy
h2. PuppetCA
76 1
77 4 Ohad Levy
Foreman will enable host autosign during provisioning time, that means, the user which executes Foreman must have:
78 3 Ohad Levy
1. write access to /etc/puppet/autosign.conf
79 3 Ohad Levy
2. sudo access to run puppetca
80 3 Ohad Levy
81 3 Ohad Levy
Once a host (which is enabled for build) is requesting a kickstart/jumpstart etc than an entry would be created in the autosign.conf file.
82 4 Ohad Levy
Each operating system will run puppetd after the OS installation but before the first reboot, this will acquire the puppet certificate, then the host will notify Foreman that it has finished the installation, and Foreman will remove the entry from the autosign file automatically.
83 3 Ohad Levy
84 3 Ohad Levy
85 1
h2. Whats inside the Kickstart / jumpstart /preseed ?
86 1
87 4 Ohad Levy
These files are all generated dynamically based on the setting of each host in Foreman, things like partition tables and root password can be unique per server.
88 1
 
89 1
if you want to see the kickstart/preseed etc you may use the spoof parameter, just point your browser to:
90 1
91 4 Ohad Levy
<pre>http://foremanhost:3000/unattended/kickstart?spoof=123.321.123.321</pre>
92 1
 
93 1
* 123.321.123.321 is the hosts IP Address (the one you want to build).
94 1
* usually you want to see the page source, the browser might display the file in html which will result in hard to read output.
95 1
* if you are using passenger please remove the ":3000" from the URL.
96 1
97 18 Justin Sherrill
h2. Modifying/Creating the template
98 1
99 18 Justin Sherrill
See [[TemplateWriting]]
100 1
101 1
h3. Snippets support
102 5 Ohad Levy
103 5 Ohad Levy
as of version 0.1-2 snippets support was added, for reusable code that be shared between operating systems deployments (e.g. puppet.conf).
104 18 Justin Sherrill
They are pure ERB templates (same as puppet templates) and could be modified/added from the "Provisioning Templates" page.  To mark a template a snippet, simply tick the 'snippet' box for that template.
105 5 Ohad Levy
106 18 Justin Sherrill
Later you can call it from the existing templates:
107 5 Ohad Levy
<pre>
108 18 Justin Sherrill
<%= snippet "vmware" -%>
109 5 Ohad Levy
</pre>
110 10 Ohad Levy
111 10 Ohad Levy
h3. Dynamic disk partition
112 10 Ohad Levy
113 10 Ohad Levy
It is possible to use a script (e.g a kickstart post script) instead of a static partition table.
114 10 Ohad Levy
see [[Dynamic disk partioning]]