Unattended installations

Version 11 (Jochen Schalanda, 05/23/2010 01:58 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 4 Ohad Levy
Foreman automates network boot processes using PXEboot (or native Solaris net:dhcp)
6 1
7 9 Paul Kelly
At this time, Foreman does not support DHCP and DNS alteration, you would need to do those steps manually. [[Netdb|DHCP/DNS management. Coming soon]]
8 1
9 1
h2. TFTP
10 1
11 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.
12 4 Ohad Levy
future versions of Foreman would allow remote TFTP servers as well.
13 1
14 1
make sure you add into your config/settings.yml
15 1
<pre> :tftppath: /var/lib/tftpboot/pxelinux.cfg</pre>
16 4 Ohad Levy
replace the value with your actual TFTP directory and ensure that the *user which executes Foreman  have write access*.
17 1
18 1
19 4 Ohad Levy
h3. How does Foreman manages TFTP?
20 1
21 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,
22 1
This link would point to a predefined syslinux(pxelinux) boot file which would be based on the Operating System used.
23 1
24 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.
25 7 Matt Moran
26 1
after a successful OS installation, that link will be removed, and your default PXE settings will be served.
27 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.
28 1
29 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.
30 1
31 11 Jochen Schalanda
*+Examples+*:
32 11 Jochen Schalanda
33 11 Jochen Schalanda
*CentOS 5 32bit*:
34 1
<pre>default linux
35 1
label linux
36 4 Ohad Levy
kernel boot/centos-5-32.vmlinuz
37 1
append initrd=boot/centos-5-32.initrd.img ks=http://foremanhost/unattended/kickstart ksdevice=eth0 network kssendmac
38 1
</pre>
39 1
40 11 Jochen Schalanda
*Ubuntu 10.04 32bit*:
41 1
<pre>default preseed
42 1
label preseed
43 11 Jochen Schalanda
kernel ubuntu/lucid/x86_64/linux
44 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>
45 11 Jochen Schalanda
46 11 Jochen Schalanda
Tweakable options:
47 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.
48 11 Jochen Schalanda
* @url@: The URL to the preseed file provided by Foreman.
49 11 Jochen Schalanda
* @locale@: The locale used during the installation.
50 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.
51 11 Jochen Schalanda
52 1
53 3 Ohad Levy
h2. PuppetCA
54 1
55 4 Ohad Levy
Foreman will enable host autosign during provisioning time, that means, the user which executes Foreman must have:
56 3 Ohad Levy
1. write access to /etc/puppet/autosign.conf
57 3 Ohad Levy
2. sudo access to run puppetca
58 3 Ohad Levy
59 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.
60 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.
61 3 Ohad Levy
62 3 Ohad Levy
63 1
h2. Whats inside the Kickstart / jumpstart /preseed ?
64 1
65 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.
66 1
 
67 1
if you want to see the kickstart/preseed etc you may use the spoof parameter, just point your browser to:
68 1
69 4 Ohad Levy
<pre>http://foremanhost:3000/unattended/kickstart?spoof=123.321.123.321</pre>
70 1
 
71 1
* 123.321.123.321 is the hosts IP Address (the one you want to build).
72 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.
73 1
* if you are using passenger please remove the ":3000" from the URL.
74 1
75 1
h2. Modifying the unattended template
76 1
77 1
You probably want to do minor teaks to your kickstart/jumpstart/preseed template (yeah the same kind puppet uses).
78 1
the template for can be found at:
79 1
RedHat based installation
80 1
<pre>app/view/unattended/kickstart.rhtml</pre>
81 1
Debian/Ubuntu installations 
82 1
<pre>app/view/unattended/preseed.rhtml</pre>
83 1
and a finish script
84 1
<pre>app/view/unattended/preseed_finish.rhtml</pre>
85 5 Ohad Levy
86 5 Ohad Levy
h3. Snippets support
87 5 Ohad Levy
88 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).
89 5 Ohad Levy
They are pure ERB templates (same as puppet templates) and could be modified at the following directory:
90 5 Ohad Levy
<pre>
91 5 Ohad Levy
app/views/unattended/snippets
92 5 Ohad Levy
</pre>
93 5 Ohad Levy
94 6 Ohad Levy
in order to create a new snippet place it in that the same directory and prefix it with a "_". later you can call it from the existing templates:
95 5 Ohad Levy
<pre>
96 5 Ohad Levy
<%= snippets "vmware" -%>
97 5 Ohad Levy
</pre>
98 10 Ohad Levy
99 10 Ohad Levy
h3. Dynamic disk partition
100 10 Ohad Levy
101 10 Ohad Levy
It is possible to use a script (e.g a kickstart post script) instead of a static partition table.
102 10 Ohad Levy
see [[Dynamic disk partioning]]