Creating the kickstart template

From ISPWiki

Jump to: navigation, search

In DSmanager 4.4.12 and later you can install an operating system using the Kickstart mechanism.

Creating a template

  • Create a directory for your template in /DS/DStemplates (for example, "/DS/DStemplates/CentOS-6-i386-kickstart").
  • Put the kernel into the kernel file and image into the initrd file (if you run CentOS-6 you can take it from http://mirror.yandex.ru/centos/6/os/i386/images/pxeboot/ vmlinuz - is the kernel) and locate them into the directory.
  • Create the kickinfo file which contains the information to be added into the append section of the pxeboot file. Example:
headless lang=en_US keymap=us ksdevice=link proxy=82.146.47.185:3128 method=http://mirror.yandex.ru/centos/6/os/i386/
  • Create the kick.txt which is the kickstart script.

kick.txt

This file includes the following fields that are filled out by DSmanager:

($PASS) - will be changed into an encrypted password (the --iscrypted option will be activated).

($SERVER) - will be changed into the IP address of the server where Dsmanager is installed.

($AUTH) - the auth field. It is used to inform DSmanager that the installation is complete.


Put the following line at the end of the script to inform Dsmanager that the installation is complete:

wget --no-check-certificate -O /dev/null -q 'https://($SERVER)/manager/dsmgr?auth=($AUTH)&func=ds.reinstall&sok=ok&complete=on'

Example

%pre

#!/bin/sh

#if [ `cat /proc/scsi/scsi | grep -wc ATA` -eq 2 ]; then

#cat > /tmp/part-include << EOF
#part raid.11 --size=100 --asprimary --ondisk=sda
#part raid.12 --size=4096 --asprimary --ondisk=sda 
#part raid.13 --size=1 --grow --asprimary --ondisk=sda 
##part raid.13 --size=10000 --asprimary --ondisk=sda 
##
#part raid.21 --size=100 --asprimary --ondisk=sdb
#part raid.22 --size=4096 --asprimary --ondisk=sdb 
#part raid.23 --size=1 --grow --asprimary --ondisk=sdb 
##part raid.23 --size=10000 --asprimary --ondisk=sdb 
##
#raid /boot --fstype ext2 --device md0 --level=RAID1 raid.11 raid.21
#raid swap --fstype swap --device md1 --level=RAID1 raid.12 raid.22
#raid /    --fstype ext4 --device md2 --level=RAID1 raid.13 raid.23
#EOF
#else

cat > /tmp/part-include << EOF
part /boot --fstype ext2 --size=100 --asprimary --ondisk=sda
part swap --size=4096 --asprimary --ondisk=sda
part / --fstype ext4 --size=1 --grow --asprimary --ondisk=sda
EOF
#fi

%end

auth --useshadow --enablemd5
bootloader --location=mbr
zerombr yes
clearpart --all --initlabel
firstboot --disable

%include /tmp/part-include

# System keyboard
keyboard us
# System language
lang en_US.UTF-8
# Installation logging level
logging --level=info
# Use NFS installation media
url --url http://mirror.yandex.ru/centos/6/os/i386/
#Root password
rootpw ($PASS)

# SELinux configuration
selinux --disabled
# System timezone
timezone --utc Europe/Moscow
# Install OS instead of upgrade
install

%packages
@core
@server-policy

%post --nochroot
cat > /mnt/sysimage/etc/sysconfig/iptables << EOF
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
COMMIT
EOF
mkdir /mnt/sysimage/root/.ssh
cat > /mnt/sysimage/root/.ssh/authorized_keys << EOF
EOF
wget --no-check-certificate -O /dev/null -q 'https://($SERVER)/manager/dsmgr?auth=($AUTH)&func=ds.reinstall&sok=ok&complete=on'
reboot
%end
Was this helpful? Yes | No
Views
Personal tools