Unattended installations
Version 8 (Matt Moran, 01/08/2010 02:03 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 | 4 | Ohad Levy | At this time, Foreman does not support DHCP and DNS alteration, you would need to do those steps manually. |
| 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 | 4 | Ohad Levy | 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 | 1 | an example of a such a file for CentOS 5 32bit: |
|
| 32 | 1 | <pre>default linux |
|
| 33 | 1 | label linux |
|
| 34 | 2 | Ohad Levy | kernel boot/centos-5-32.vmlinuz |
| 35 | 4 | Ohad Levy | append initrd=boot/centos-5-32.initrd.img ks=http://foremanhost/unattended/kickstart ksdevice=eth0 network kssendmac |
| 36 | 1 | </pre> |
|
| 37 | 1 | ||
| 38 | 1 | and another example for Ubuntu 9.04 32bit |
|
| 39 | 1 | <pre>default preseed |
|
| 40 | 1 | label preseed |
|
| 41 | 1 | kernel boot/ubuntu-9.04-32.linux |
|
| 42 | 4 | Ohad Levy | append initrd=boot/ubuntu-9.04-32.initrd.gz ramdisk_size=10800 root=/dev/rd/0 rw auto preseed/url=http://foremanhost/unattended/preseed console-keymaps-at/keymap=us locale=en_US interface=eth0 DEBCONF_PRIORITY=critical netcfg/dhcp_timeout=60 -- |
| 43 | 1 | </pre> |
|
| 44 | 1 | ||
| 45 | 3 | Ohad Levy | h2. PuppetCA |
| 46 | 1 | ||
| 47 | 4 | Ohad Levy | Foreman will enable host autosign during provisioning time, that means, the user which executes Foreman must have: |
| 48 | 3 | Ohad Levy | 1. write access to /etc/puppet/autosign.conf |
| 49 | 3 | Ohad Levy | 2. sudo access to run puppetca |
| 50 | 3 | Ohad Levy | |
| 51 | 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. |
| 52 | 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. |
| 53 | 3 | Ohad Levy | |
| 54 | 3 | Ohad Levy | |
| 55 | 1 | h2. Whats inside the Kickstart / jumpstart /preseed ? |
|
| 56 | 1 | ||
| 57 | 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. |
| 58 | 1 | ||
| 59 | 1 | if you want to see the kickstart/preseed etc you may use the spoof parameter, just point your browser to: |
|
| 60 | 1 | ||
| 61 | 4 | Ohad Levy | <pre>http://foremanhost:3000/unattended/kickstart?spoof=123.321.123.321</pre> |
| 62 | 1 | ||
| 63 | 1 | * 123.321.123.321 is the hosts IP Address (the one you want to build). |
|
| 64 | 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. |
|
| 65 | 1 | * if you are using passenger please remove the ":3000" from the URL. |
|
| 66 | 1 | ||
| 67 | 1 | h2. Modifying the unattended template |
|
| 68 | 1 | ||
| 69 | 1 | You probably want to do minor teaks to your kickstart/jumpstart/preseed template (yeah the same kind puppet uses). |
|
| 70 | 1 | the template for can be found at: |
|
| 71 | 1 | RedHat based installation |
|
| 72 | 1 | <pre>app/view/unattended/kickstart.rhtml</pre> |
|
| 73 | 1 | Debian/Ubuntu installations |
|
| 74 | 1 | <pre>app/view/unattended/preseed.rhtml</pre> |
|
| 75 | 1 | and a finish script |
|
| 76 | 1 | <pre>app/view/unattended/preseed_finish.rhtml</pre> |
|
| 77 | 5 | Ohad Levy | |
| 78 | 5 | Ohad Levy | h3. Snippets support |
| 79 | 5 | Ohad Levy | |
| 80 | 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). |
| 81 | 5 | Ohad Levy | They are pure ERB templates (same as puppet templates) and could be modified at the following directory: |
| 82 | 5 | Ohad Levy | <pre> |
| 83 | 5 | Ohad Levy | app/views/unattended/snippets |
| 84 | 5 | Ohad Levy | </pre> |
| 85 | 5 | Ohad Levy | |
| 86 | 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: |
| 87 | 5 | Ohad Levy | <pre> |
| 88 | 5 | Ohad Levy | <%= snippets "vmware" -%> |
| 89 | 5 | Ohad Levy | </pre> |
