Unattended OS installation configuration system
The project goal is to provide a flexible and as simple as possible configuration tool for unattended OS installation via network for various linux distributions. It was designed to setup dozen of production and other servers and can be used by professional system administrators or for development/testing/education purposes. The playbook contains ready to use installation templates for various distributions.
A copy of a OS distribution itself is not required(!) and with the supplied default configuration an OS installation will be performed via internet from http://mirror.yandex.ru site. However if you are going to setup dozens of servers it's highly recommended to make and configure a local mirror for the required OS.
Templates for unattended installation included in the playbook:
Other distributions which support kickstart/preseed/autoyast can be easily added.
The playbook generates pxe boot and EFI grub menu files, so if you setup pxe boot environment(briefly described at the end) you'll have a convenient way to manage servers installation.
The playbook supports any number of an OS configurations so if you have several groups of servers with different configuration you can describe it in separate autoinstall 'receipt' files.
The playbook is not supposed to cover setup for network boot services environment but focused on providing a ‘framework’ for generation autoinstall files for various distributions.
In the order to effectively use the playbook for your particular purposes you have to understand the principles of Linux network boot and have a base knowledge about autoinstall files for the required OS:
Ansible version >= 2.2.1.0
In the order to perform install you need working PXE boot environment services:
Global configuration variables defined at site_vars.yml Templates for autoinstall files at templates/ks , templates/preseed and templates/yast directories.
The configuration is performed via hosts file and autoinstall files customization.
If ip is not specified, DHCP will be used
Autoinstall file location and name convention: templates/<ks|preseed|yast>/<os>.<osver>[.type].cfg.j2 as an instance centos.7.cfg.j2
A host must belong to at least one of the groups:
The group is used to identify the type of autoinstall.
ansible-playbook -i hosts site.yaml
# configure epel release
yum install http://mirror.yandex.ru/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
# install required packages
yum install syslinux-tftpboot tftp-server dhcp xinetd nginx
# if you are going to use UEFI boot, you need to put grub2 efi loader, as an instance
mkdir -p /var/lib/tftpboot/efi.cfg
curl https://mirror.yandex.ru/centos/7/os/x86_64/EFI/BOOT/grubx64.efi > /var/lib/tftpboot/efi.cfg/grubx64.efi
# provide minimal dhcp configuration
cat <<'EOF' > /etc/dhcp/dhcpd.conf
allow unknown-clients;
default-lease-time 1800;
max-lease-time 7200;
option arch code 93 = unsigned integer 16; # RFC4578
set pxetype = option arch;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.128 10.0.0.254;
option broadcast-address 10.0.0.255;
option domain-name-servers 10.0.0.1;
option domain-name localdomain;
default-lease-time 1800;
max-lease-time 7200;
option netbios-name-servers 10.0.0.1;
option routers 10.0.0.1;
next-server 10.0.0.1;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if pxetype=00:09 or pxetype=00:07 {
filename "efi.cfg/grubx64.efi";
} else {
filename "gpxelinux.0";
}
}
}
EOF
# configure nginx to serve autoinstall files
cat <<'EOF' >/etc/nginx/default.d/ks.conf
location /kickstart {
root /var/lib/;
}
EOF
# start services
service dhcpd start
service xinetd start
service nginx start