autoinstall(8)
is your tool to do this task since OpenBSD 5.5. Using dhcp+pxe
and a http server you are good enough to deploy an automated install infrastructure. This topic is well explained on this bsdnow.tv how-to, but I will make some comments on this how-to:
Create a dhcp pxe entry. The example below, will search for the auto_install
file instead of pxeboot
option domain-name-servers 192.168.1.1;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
filename "auto_install";
next-server 192.168.1.1;
range 192.168.1.8 192.168.1.254;
[..other stuff..]
}
Using a tftp
server, host the needed files to boot using pxe. You will also need to enable pxe-boot at the client site on its bios:
# ls -l /tftp
total 12896
lrwxr-xr-x 1 root wheel 7 Feb 22 21:37 auto_install -> pxeboot
-rw-r--r-- 1 root wheel 6501415 Feb 22 12:49 bsd
-rw-r--r-- 1 root wheel 80524 Feb 22 12:50 pxeboot
Host all the installation packages inside your htdocs
root directory, and configure your httpd.conf
accordingly :
# ls /var/www/htdocs/pub/OpenBSD/5.5/i386/
SHA256 bsd comp55.tgz index.txt xetc55.tgz xshare55.tgz
SHA256.sig bsd.mp etc55.tgz man55.tgz xfont55.tgz
base55.tgz bsd.rd game55.tgz xbase55.tgz xserv55.tgz
Inside your httpd
root directory, create an install.conf
file with all the answers to the questions asked by the installer.
# cat /var/www/htdocs/install.conf
System hostname = bsdnow.tv
Password for root = ThePlaceToBe...SD
Network interfaces = em0
IPv4 address for em0 = dhcp
Setup a user = puffy
Password for user = whywasibornasafish
What timezone are you in = US/Eastern
Location of sets = http
Server = 192.168.1.1
Note that you could be also using nginx
here. The important thing here is that it needs to be placed at the server root with the install.conf
name. Also, there is no comprehensive list of the parameters that can be used at autoinstall
so, do your search to find good examples like here. Quoting autoinstall
manpages:
The response file is a line-oriented ASCII text file. The format of
each line is:
question = answer
question is an installer question (not including the question mark) or
a non-ambiguous part of it, consisting of whitespace separated words.
answer is the answer to the question. Passwords may be in plaintext,
encrypted with encrypt(1), or set to ‘*************’ (13 '*'s) to
disable password logins, only permitting alternative access methods
(for example, ssh(1) keys).
You can also use MAC_address-install.conf
or hostname-install.conf
(if hostname is defined at dhcpd.conf
) to create an install routine to just one host.
Just boot up the machine, and wait for the installation job to finish.
Also, sky is the limit here. Take a look at this Complicated Example from CoBUG that will create a vm dinamically, feed database and httpd files to configure it and start the installation. All with just one command ;)