This was our shop’s first real dive into kickstarts. The material I read in Visible Ops really emphasized track able/repeatable processes for setting up systems. One great way to do that is through kickstart scripts and some kind of version control system. We used Subversion.
I’ve edited a few parts out of this, but I spent a while finding several kickstart scripts that accomplished parts of what we needed. I highly customized one for our environment.
What it does:
- Configures licensing for the host using a license server
- Configures NTP
- Adds users, expires their accounts and configures a sudo group
- MOTD
- Configures NICs and VMware ESX Networking
- Creates a script to download and install IBM iSCSI Host Utilities Kit
- Creates a script to download and install QLA4050C BIOS and firmware updates
Thanks to Leo’s ESX 3.5 Kickstart script – part 3.
You will need to download IBM iSCSI Host Utilities Kit from IBM and the QLA4050C BIOS and Firmware from QLogic to a server with scp capabilities.
# make sure this file is UNIX formatted so the line breaks can be handled. install lang en_US.UTF-8 langsupport --default en_US.UTF-8 keyboard us mouse genericwheelps/2 --device psaux skipx network --device eth0 --bootproto static --ip <ip> --netmask <netmask> --gateway <gw> --nameserver <dns1>,<dns2> --hostname <hostname> --addvmportgroup=0 --vlanid=0 # Encrypted root password rootpw --iscrypted <password> firewall --enabled authconfig --enableshadow --enablemd5 timezone America/Chicago bootloader --location=mbr # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work vmaccepteula # test license server vmlicense --mode=server --server=27000@<vc> --edition=esxFull --features=vsmp,backup reboot firewall --enable clearpart --exceptvmfs --drives=sda part /boot --fstype ext3 --size=100 --ondisk=sda part / --fstype ext3 --size=1800 --grow --maxsize=5000 --ondisk=sda part swap --size=544 --grow --maxsize=544 --ondisk=sda part /var/log --fstype ext3 --size=100 --grow --ondisk=sda %packages grub @base %post cat > /etc/rc.d/rc3.d/S11servercfg << EOF #Configure NTP echo "Configuring NTP" chkconfig --level 345 ntpd on echo "restrict kod nomodify notrap noquery nopeer" > /etc/ntp.conf echo "restrict 127.0.0.1" >> /etc/ntp.conf echo "server <ntp> >> /etc/ntp.conf echo "driftfile /var/lib/ntp/drift" >> /etc/ntp.conf echo <ntp>" > /etc/ntp/step-tickers service ntpd start #Adding users with default password "changeme" generated with `openssl passwd changeme` echo "Adding users" adduser <user1> -p MKgX23V6snwoc chage -d 0 -M 99999 <user1> adduser <user2> -p MKgX23V6snwoc chage -d 0 -M 99999 <user2> adduser <user3> -p MKgX23V6snwoc chage -d 0 -M 99999 <user3> usermod -G wheel user usermod -G wheel user2 usermod -G wheel user3 echo "Done adding users" echo "Configuring sudoers" cat > /etc/sudoers << SUDO # sudoers file. # # This file MUST be edited with the 'visudo' command as root. # # See the sudoers man page for the details on how to write a sudoers file. # # Host alias specification # User alias specification # Cmnd alias specification # Defaults specification Defaults syslog=local2 # User privilege specification root ALL=(ALL) ALL # Uncomment to allow people in group wheel to run all commands %wheel ALL=(ALL) ALL # Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL # Samples # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom # %users localhost=/sbin/shutdown -h now SUDO echo "Done configuring sudoers" echo "Configuring MOTD" echo "MOTD HERE" > /etc/motd echo "Done configuring MOTD" echo "Configuring hosts file" echo "ip hostname.fqdn hostname" >> /etc/hosts echo "Done configuring hosts file" # we have 6 nics echo "Configuring NIC duplex/speeds" /usr/sbin/esxcfg-nics -s 1000 -d full vmnic0 /usr/sbin/esxcfg-nics -s 1000 -d full vmnic1 /usr/sbin/esxcfg-nics -s 1000 -d full vmnic2 /usr/sbin/esxcfg-nics -s 1000 -d full vmnic3 /usr/sbin/esxcfg-nics -s 1000 -d full vmnic4 /usr/sbin/esxcfg-nics -s 1000 -d full vmnic5 echo "Configuring NIC duplex/speeds" echo "Configuring networking" # VMNetwork /usr/sbin/esxcfg-vswitch -a vSwitch1 # Blind Switch /usr/sbin/esxcfg-vswitch -a vSwitch2 # VMkernel /usr/sbin/esxcfg-vswitch -a vSwitch3 # Add NIC 1 and 3 to vSwitch1 (VMNetwork) /usr/sbin/esxcfg-vswitch -L vmnic1 vSwitch1 /usr/sbin/esxcfg-vswitch -L vmnic3 vSwitch1 # Add NIC 2 to vSwitch0 (Service Console, already contains NIC 0) /usr/sbin/esxcfg-vswitch -L vmnic2 vSwitch0 # Add NIC 4 and 5 to vSwitch3 (VMkernel) /usr/sbin/esxcfg-vswitch -L vmnic4 vSwitch3 /usr/sbin/esxcfg-vswitch -L vmnic5 vSwitch3 # Give appropriate port group labels to vSwitches /usr/sbin/esxcfg-vswitch -A "Blind Switch" vSwitch2 /usr/sbin/esxcfg-vswitch -A "VMkernel" vSwitch3 /usr/sbin/esxcfg-vswitch -A "VMNetwork" vSwitch1 # Configure IP addresses for service console and VMkernel /usr/sbin/esxcfg-vswif -i <ip> -n 255.255.255.0 vswif0 /usr/sbin/esxcfg-vmknic -a -i <vmotion address> -n 255.255.255.0 VMotion /usr/sbin/esxcfg-vswif -E # Enable SSH Client through firewall /usr/sbin/esxcfg-firewall -e sshClient echo "Done configuring networking" # generate script to download/install HUK, make it executable echo "Generating host utilities download/install script" cat > /root/huk-install.sh << HUK cd /home/user/ scp user@host:/home/user/ibm_iscsi_esx_host_utilities_3_1.tar.gz . tar -zxf ibm_iscsi_esx_host_utilities_3_1.tar.gz cd ibm_iscsi_esx_host_utilities_3_1 ./install echo "Done generating host utilities download/install script" HUK chmod a+x /root/huk-install.sh # generate script to download/install iscli and firmware/BIOS updates, make it executable echo "Generating iscli and firmware update script" cat > /root/iscli-script.sh << ISCLI cd /home/user/ scp user@host:/home/user/iscli-1.2.00-15_linux_i386.install.tar.gz user@host:/home/user/ql4022rm.BIN user@host:/home/user/VER4032_03_00_01_53.zip . tar -xvzf iscli-1.2.00-15_linux_i386.install.tar.gz unzip VER4032_03_00_01_53.zip chmod +x iscli.dkms.install.sh ./iscli.dkms.install.sh install # HBA 0 /usr/local/bin/iscli -f 0 /home/user/qla4022.dl sleep 5 /usr/local/bin/iscli -bootcode 0 /home/user/ql4022rm.BIN sleep 5 # HBA 1 /usr/local/bin/iscli -f 1 /home/user/qla4022.dl sleep 5 /usr/local/bin/iscli -bootcode 1 /home/user/ql4022rm.BIN sleep 5 reboot ISCLI echo "Done generating iscli and firmware script" # Moves this file so it will not be called on next host boot mv /etc/rc.d/rc3.d/S11servercfg /root/unsw-setup.sh rm -f /root/system-info EOF /bin/chmod a+x /etc/rc.d/rc3.d/S11servercfg
Advertisement