From 6cbe76f16b8b99f64815be1444517e82ad27f262 Mon Sep 17 00:00:00 2001 From: Orien Vandenbergh Date: Thu, 30 Jan 2014 23:44:11 -0700 Subject: [PATCH] Started my kickstart infrastructure scripts --- kickstart/defs/common/sde/site.json | 3 + kickstart/defs/temari/temari.json | 13 ++ kickstart/ks.json | 3 + kickstart/ks.rb | 64 +++++++ kickstart/rhel6.cfg | 51 +++++ kickstart/sample_kickstart.cfg | 181 ++++++++++++++++++ kickstart/sample_rhel6.32.cfg | 243 ++++++++++++++++++++++++ kickstart/sample_rhel6.64.cfg | 285 ++++++++++++++++++++++++++++ kickstart/write_config.rb | 12 ++ 9 files changed, 855 insertions(+) create mode 100644 kickstart/defs/common/sde/site.json create mode 100644 kickstart/defs/temari/temari.json create mode 100644 kickstart/ks.json create mode 100644 kickstart/ks.rb create mode 100644 kickstart/rhel6.cfg create mode 100644 kickstart/sample_kickstart.cfg create mode 100644 kickstart/sample_rhel6.32.cfg create mode 100644 kickstart/sample_rhel6.64.cfg create mode 100644 kickstart/write_config.rb diff --git a/kickstart/defs/common/sde/site.json b/kickstart/defs/common/sde/site.json new file mode 100644 index 0000000..2acf148 --- /dev/null +++ b/kickstart/defs/common/sde/site.json @@ -0,0 +1,3 @@ +{ + "ldap_server": "host1.domain.com" +} diff --git a/kickstart/defs/temari/temari.json b/kickstart/defs/temari/temari.json new file mode 100644 index 0000000..3c7c3dc --- /dev/null +++ b/kickstart/defs/temari/temari.json @@ -0,0 +1,13 @@ +{ + "hostname": "temari", + "provision": { + "flags": true + }, + "machine_type": "B10:SDE:Linux Desktop", + "site": "sde", + "run_list": [ + "Base_RHEL_64_Workstation", + "App_Linux_Workstation", + "RHEL_AntiVirus" + ] +} diff --git a/kickstart/ks.json b/kickstart/ks.json new file mode 100644 index 0000000..df9831b --- /dev/null +++ b/kickstart/ks.json @@ -0,0 +1,3 @@ +{ + "machine_definitions": "defs" +} diff --git a/kickstart/ks.rb b/kickstart/ks.rb new file mode 100644 index 0000000..adc55bd --- /dev/null +++ b/kickstart/ks.rb @@ -0,0 +1,64 @@ +#!/opt/chef/embedded/bin/ruby +# + +require "cgi" +require "json" + +def parse_json(filename) + o = nil + File.open(filename) do |f| + o = JSON.parse(f.read) + end +end +def find_host(opts,hostname) + # Return a host object, formed from the json file in the first + # matching machine configuration directory. + host = nil + machdir = File.join(opts['machine_definitions'],hostname) + machfile = File.join(opts['machine_definitions'],hostname,hostname+'.json') + + if Dir.exists?(machdir) + if File.exists?(machfile) + host = parse_json(machfile) + end + end + + host +end + +confdir = "."; +opts = parse_json(confdir + '/ks.json') + +cgi = CGI.new + +clientip = cgi.remote_addr +clientname = cgi.remote_host +clientarch = ENV['X-Anaconda-Architecture'] + +clientname ||= 'temari' + +host = find_host(opts,clientname) + +puts cgi.header("text/plain") + +node = parse_json(opts['machine_definitions']+'/'+clientname+'/'+clientname+'.json') +site = parse_json(opts['machine_definitions']+'/common/'+node['site']+'/site.json') + +puts "node" +p node +puts "site" +p site + +node = site.merge(node) +puts "updated node" +p node + +rhel_oes = node['run_list'].select(/RHEL/i) +server = rhel_oes.select(/server/i) +workstation = rhel_oes.select(/workstation|desktop/i) + +if cgi.has_key?('validate') + puts "Running reprovision script, just validate the configuration and return if valid" +else + puts "Someone is actually asking for the kickstart configuration file, fetch it" +end diff --git a/kickstart/rhel6.cfg b/kickstart/rhel6.cfg new file mode 100644 index 0000000..9acc51c --- /dev/null +++ b/kickstart/rhel6.cfg @@ -0,0 +1,51 @@ +# Begin v7 kickstart file for RHEL6 x86_64 +install + +url --url http://{SERVER_NAME}/repo/{PLATFORM}/{CLIENT_ARCH} + +text +lang en_US.UTF-8 +keyboard us + +timezone --utc Etc/UTC + +clearpart --all --initlabel +ignoredisk --only-use={BOOT_DRIVE} +part /boot --fstype=ext4 --size=500 --ondisk={BOOT_DRIVE} --asprimary +part pv.01 --grow --size=500 --ondisk={BOOT_DRIVE} --asprimary + +volgroup {VG_NAME} --pesize=32768 pv.01 + +logvol / --fstype=ext4 --name=lv_root --vgname={VG_NAME} --size=10240 --maxsize=20480 --grow # 10-20g +logvol /opt --fstype=ext4 --name=lv_home --vgname={VG_NAME} --size=10240 --maxsize=20480 --grow # 20g +logvol /var --fstype=ext4 --name lv_var --vgname={VG_NAME} --size=5120 --maxsize=10240 --grow # 5-10g +logvol /mnt --fstype=ext4 --name=lv_mnt --vgname={VG_NAME} --size=1 # 1m +logvol swap --fstype=swap --name=lv_swap --vgname={VG_NAME} --recommended + +reboot + +repo --name=rhel --baseurl=http://{SERVER_NAME}/repo/{PLATFORM}/{CLIENT_ARCH} +repo --name=project --baseurl=http://{SERVER_NAME}/repo/Project/{CLIENT_ARCH} + +sshpw --username= [--iscrypted|--plaintext] [--lock] + +authconfig --enableldap --enableldapauth --ldapserver={LDAP_HOST} --ldapbasedn="{LDAP_BASE_DN}" + +%packages +@core +@base + +%pre +#Cache the interesting current system configurations, before the formatting +mkdir /tmp/ram +mount -t tmpfs -o size=256m tmpfs /tmp/ram +# do some mounts, then save the ssh keys +cp -a /etc/ssh/host_key* /tmp/ram +cp -a /host_key* /tmp/ram +# do some unmounts +%end +%post --nochroot +# copy data from /tmp/ram into /mnt/sysimage +%post +# chef +%end diff --git a/kickstart/sample_kickstart.cfg b/kickstart/sample_kickstart.cfg new file mode 100644 index 0000000..97f3aa8 --- /dev/null +++ b/kickstart/sample_kickstart.cfg @@ -0,0 +1,181 @@ + +######################################################################### +# +# Red Hat Academy Classroom Server Kickstart Script +# +# $Id: 010_text.dbk,v 1.5 2005/08/08 08:35:41 bowe Exp $ +# version: RHEL4 +# academy-docs@redhat.com +# +# For more information, see the Red Hat Customization Guide, +# http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/ch-kickstart2.html +# +######################################################################### + +############################################################### +# you definately want to set one of the following +############################################################### + +rootpw redhat +bootloader --location=mbr --password=redhat + +########################################################################### +# +# the following MD5 encrypted passwords can be generated using +# +# openssl passwd -1 redhat +# +# see "man sslpasswd" for more information +# +########################################################################### +#rootpw --isencrypted $1$Su2Gv/$fZeEi7RtQq/RAZ1oEla5z0 # md5 encrypted "redhat" +#bootloader --location=mbr --md5pass=$1$x.3x1cDe$ucwc8hTScWzfb5DYW6r25/ + + +############################################################### +# point to a local installation server, or use "cdrom" +############################################################### +text # you're not going to be standing there watching it, are you? +cdrom +# url --url http://kickstart.example.com/pub/es4/i386 + + +############################################################### +# partitioning +############################################################### +zerombr yes +clearpart --all --initlabel +part /boot --fstype ext3 --size 128 +part / --fstype ext3 --size 4096 --grow --maxsize 8192 +part /var --fstype ext3 --size 4096 --grow --maxsize 8192 +part swap --recommended + +#Very important to have the two part lines before the lvm stuff +volgroup VG --pesize=32768 pv.5xwrsR-ldgG-FEmM-2Zu5-Jn3O-sx9T-unQUOe +logvol / --fstype=ext4 --name=lv_root --vgname=VG --size=40960 +logvol /home --fstype=ext4 --name=lv_home --vgname=VG --size=25600 +logvol swap --fstype swap --name=lv_swap --vgname=VG --size=4096 + +bootloader --location=mbr --driveorder=sda --append="rhgb quiet" + +############################################################### +# network configuration +# - the following is for the "recommended solution" outlined +# in the Red Hat Academy Instructor's Guide +############################################################### +network --bootproto=static --ip=192.168.0.254 --netmask=255.255.255.0 --device=eth0 +network --bootproto=dhcp --device=eth1 +#firewall --enabled --http --ftp --port=https:tcp --port=ipp:tcp +firewall --disabled + + +############################################################### +# environment +############################################################### +lang en_US +langsupport --default=en_US +timezone America/New_York +#timezone America/Chicago +#timezone America/Denver +#timezone America/Los_Angeles + +############################################################### +# hardware +############################################################### +mouse generic3ps/2 +#mouse genericps/2 --emulthree # enable for 2 button mice +keyboard us +xconfig --depth=16 --resolution=1024x768 --defaultdesktop=GNOME --startxonboot + + +############################################################### +# misc +############################################################### +auth --useshadow --enablemd5 +reboot # reboot automatically when done +install # instead of "upgrade" + +############################################################### +# +# New in RHEL-4: SELinux +# +############################################################### +selinux --enforcing +#selinux --permissive +#selinux --disabled + +############################################################### +# +# Software +# +############################################################### +%packages --resolvedeps +@ Workstation Common +@ Server +@ GNOME + +@ Engineering and Scientific +@ Games and Entertainment +@ Mail Server +@ DNS Name Server +@ FTP Server +@ Network Servers +@ Development Tools +@ System Tools + +ypserv +dhcp +ethereal-gnome +sysstat +vlock + +%post +############################################################### +# +# Post Script - the following script runs on the newly +# installed machine, immediately after installation +# +############################################################### + +######################################################## +# add entry to /etc/hosts, if necessary +######################################################## +#echo "192.168.0.254 rha-server" >> /etc/hosts + +######################################################## +# turn on required services +######################################################## + +chkconfig httpd on +chkconfig vsftpd on + +######################################################## +# install red hat academy custom software +######################################################## + +#RHASRC=ftp://kickstart.example.com/pub/rha/RPMS/ +#rpm -ihv $RHASRC/rha-base*.rpm $RHASRC/rha-classroom-rha*.rpm $RHASRC/rha-server-*.rpm $RHASRC/fauxlp-*.rpm +#unset RHASRC + +######################################################## +# add proxy server to /etc/rha_server.conf, if necessary +######################################################## + +#echo "ExerciseReporterProxy http://10.1.1.1:8080" >> /etc/rha_server.conf + + +######################################################## +# mirror RHEL-4-ES distribution from remote server +######################################################## + +#lftp -c "mirror ftp://kickstart.example.com/pub/es4 /var/ftp/pub/es4" + +######################################################## +# ln anonymous FTP pub dir to Document Root +######################################################## + +ln -s ../../ftp/pub /var/www/html/pub +# set SELinux context s.t. contents of pub directory available from web +chcon -R --reference /var/www/html /var/ftp/pub + + diff --git a/kickstart/sample_rhel6.32.cfg b/kickstart/sample_rhel6.32.cfg new file mode 100644 index 0000000..fc41e4d --- /dev/null +++ b/kickstart/sample_rhel6.32.cfg @@ -0,0 +1,243 @@ +# Begin preparation directions +#----------------------------- +# 1. Prepare RHEL6 yum repositories by copying the entire contents of the RHEL6 +# install media (DVD, CD, or mounted ISO files) to NFS or HTTP accessible +# directories on an install server. An example directory structure would be +# /var/www/html/rhel/6.1/i386 +# 2. Copy the v7-server package, the v7 package, and its unique dependencies +# (dt, lmbench and stress) to a new HTTP accessible directory on your +# server. The files can be found in the “RHEL Hardware Certification” RHN +# channel. An example directory name for your files would be +# /var/www/html/v7-rhel6-i386. The v7 and v7-server packages are not +# architecture dependent but the dt, lmbench and stress files are, which +# explains the need for i386 in the directory name. +# 3. Create a yum repository from the v7 files by changing into the directory +# where you copied the files and running the command “createrepo -p .”. You +# must run the command from a RHEL6 system. Do not forget the single period +# after createrepo as it tells the command where to create the new yum +# metadata files (in the current directory). This directory should only be +# used to store v7, its dependencies and the repo metadata files created by +# the createrepo command. +# 4. Repeat the previous two steps, if necessary, to copy the required v7 and +# dependency files to your web server and create v7 repositories in unique +# directories for all the architectures you will be certifying on. +# 5. Obtain the kernel-debuginfo and kernel-debuginfo-common-i686 files that +# match the version of the kernel you will be certifying on from RHN, +# and copy them to a new HTTP accessible directory on your server. An +# example directory would be /var/www/html/rhel6.1-i386-debug +# 6. Create a yum repository from the debug files by changing into the +# directory where you copied the files and running the command +# “createrepo -p .”, as you did in step three. +# 7. Repeat the previous two steps, if necessary, to create additional debug +# package repositories for any different variants (RHEL 6.0, 6.1 etc.) and +# architectures of RHEL that you will be certifying on. +# 8. Save the kickstart script you are reading now in an HTTP accessible +# directory on your server. We recommend an obvious directory like +# /var/www/html/ks. +# 9. Edit the kickstart script and: +# * Uncomment one of the two install method lines (either URL or NFS +# depending on your environment, but not both) and replace the example +# server information with your own. +# * Replace the example server information on the various server lines +# with your own server information. +# * Uncomment the v7-server line if you will be installing a server. +#10. Start the NFS (if applicable) and/or HTTP services on your server and +# configure them to load on boot. Test that you can browse the install +# tree(s) and the v7 repo(s) and confirm that you can view the kickstart +# file. +#11. Now that you have a working server, repeat steps five and six, if +# necessary, to create kickstart files for all the architectures you +# will be certifying on. Red Hat provides example i386 and x86_64 files. +# Don't forget to give each kickstart file a unique name that incorporates +# the release of RHEL and its architecture and also indicates that the +# file is for v7 installation. +#12. Boot a test system with install media and at the boot prompt, enter the +# following information: +# +# boot: linux ksdevice=bootif ks=http://myserver.mydomain.com/ks/v7-6.1-i386.cfg +# +# (Replace the server and kickstart file example text with the location and +# name of your kickstart file. You only need the 'ksdevice=bootif' if your +# system has multiple NICs.) +#13. The system will install, reboot and end at the graphical login. +#14. Log in as certuser with a password of redhat (root cannot log in at the GUI +# for security reasons). You now have a fully configured test system ready +# to run v7. +# End preparation directions + +# Begin v7 kickstart file for RHEL6 i386 +install + +# Remove the comment “#” from ONE of the two lines below to choose your install +# method and change the server information to match your own environment. +#url --url http://myserver.mydomain.com/path/to/rhel6-i386/bits +#nfs --server=myserver.mydomain.com --dir=/path/to/rhel6-i386/bits + +lang en_US.UTF-8 +keyboard us + +# The --device=eth0 is required here to prevent the system from asking +# which NIC to kickstart from. You should also use 'ksdevice=bootif' +# on the boot line if you only have one NIC connected. +network --device eth0 --bootproto dhcp +rootpw redhat +user --name=certuser --password=redhat +firewall --disabled +authconfig --enableshadow --passalgo=sha512 --enablefingerprint +selinux --enforcing +timezone --utc America/New_York +bootloader --location=mbr --driveorder=sda --append="rhgb quiet" + +# Blank all disks and write disk labels, then install to disk /dev/sda ONLY. +# DO NOT RUN THIS KICKSTART ON A SYSTEM WITH DATA YOU WISH TO KEEP +zerombr +clearpart --all --initlabel +ignoredisk --only-use=sda +part /boot --fstype=ext4 --size=500 --ondisk=sda +part swap --size=2048 --ondisk=sda +part / --fstype=ext4 --size=1024 --grow --ondisk=sda +reboot + +# Yum repository for v7, lmbench and stress dependencies. +# Change the next line to match your environment. +repo --name=v7 --baseurl=http://myserver.mydomain.com/v7-rhel6-i386 + +# Yum repository for kernel debuginfo dependencies. +# Change the next line to match your environment. +repo --name=rhel6.1-i386-debug --baseurl=http://myserver.mydomain.com/rhel6.1-i386-debug + +# Yum repository for fence agent package. Change the next line to point +# to the HighAvailability directory in your install tree +repo --name=HighAvailability --baseurl=http://myserver.mydomain.com/path/to/rhel6-i386/bits/os/HighAvailability/ + +%packages +@additional-devel +@base +@core +@debugging +@basic-desktop +@desktop-debugging +@desktop-platform +@desktop-platform-devel +@development +@emacs +@fonts +@general-desktop +@graphical-admin-tools +@graphics +@input-methods +@internet-browser +@legacy-x +@network-file-system-client +@performance +@perl-runtime +@server-platform +@server-platform-devel +@server-policy +@virtualization +@virtualization-client +@virtualization-platform +@x11 +libXinerama-devel +xorg-x11-proto-devel +startup-notification-devel +libgnomeui-devel +libbonobo-devel +junit +libXau-devel +libgcrypt-devel +popt-devel +libdrm-devel +libXrandr-devel +libxslt-devel +libglade2-devel +gnutls-devel +mtools +pax +python-dmidecode +python-lxml +oddjob +sgpio +genisoimage +wodim +abrt-gui +desktop-file-utils +ant +rpmdevtools +jpackage-utils +rpmlint +certmonger +pam_krb5 +krb5-workstation +nscd +pam_ldap +nss-pam-ldapd +netpbm-progs +libXmu +perl-DBD-SQLite +libvirt-java +dvd+rw-tools +xorg-x11-apps +sox +kabi-whitelists +createrepo +mt-st +# Required for fencing test +fence-agents +# Screen utility is helpful for running tests over an SSH session. +screen +# Midnight Commander utility is helpful for debugging test results +# in a non-GUI environment. +mc +# Install v7 and dependencies from our custom repository. +v7 +# Uncomment this package only if you are setting up a v7 test server. +#v7-server +# Install the kernel debuginfo packages required for the v7 kdump test +# in v7-1.3-43 and newer from our custom repository +kernel-debuginfo +kernel-debuginfo-common-i686 + +%post +# Set DHCP for all interfaces during %post if left unconfigured during install. +if [ `ls -1 /etc/sysconfig/network-scripts/ifcfg-eth* | wc -l` -ge 1 ] + then + for i in /etc/sysconfig/network-scripts/ifcfg-eth* + do + if ! grep -i "bootproto" $i + then + echo "BOOTPROTO=dhcp" >> $i + fi + done +fi +if [ `ls /etc/sysconfig/network-scripts/ifcfg-wlan* | wc -l` -ge 1 ] + then + for i in /etc/sysconfig/network-scripts/ifcfg-wlan* + do + if ! grep -i "bootproto" $i + then + echo "BOOTPROTO=dhcp" >> $i + fi + done +fi +# Force default kernel selection. You'll need to specify EXACTLY which +# kernel you want to boot from. This gets around the problem of the debug +# kernel being set as the default if it's installed. +# +# 1. If installing RHEL 6.0, uncomment next line to add add workaround for +# no /dev/root in %post from BZ 657257. This is fixed in RHEL 6.1 and later +#ln -s `awk '{ if ($2 == "/") print $1; }' /etc/fstab` /dev/root +# +# 2. Use grubby to set the proper boot kernel by uncommenting the line that's +# correct for the version of RHEL you're using. +# RHEL 6.0 +#grubby --set-default /boot/vmlinuz-2.6.32-71.el6.i386 +# RHEL 6.1 +#grubby --set-default /boot/vmlinuz-2.6.32-131.0.15.el6.i386 +# RHEL 6.2 +#grubby --set-default /boot/vmlinuz-2.6.32-220.el6.i386 +# RHEL 6.3 +grubby --set-default /boot/vmlinuz-2.6.32-279.el6.i386 +%end +# End v7 kickstart file for RHEL6 i386 + diff --git a/kickstart/sample_rhel6.64.cfg b/kickstart/sample_rhel6.64.cfg new file mode 100644 index 0000000..908b035 --- /dev/null +++ b/kickstart/sample_rhel6.64.cfg @@ -0,0 +1,285 @@ +# Begin preparation directions +#----------------------------- +# 1. Prepare RHEL6 yum repositories by copying the entire contents of the RHEL6 +# install media (DVD, CD, or mounted ISO files) to NFS or HTTP accessible +# directories on an install server. An example directory structure would be +# /var/www/html/rhel/6.1/x86_64 +# 2. Copy the v7-server package, the v7 package, and its unique dependencies +# (dt, lmbench and stress) to a new HTTP accessible directory on your +# server. The files can be found in the “RHEL Hardware Certification” RHN +# channel. An example directory name for your files would be +# /var/www/html/v7-rhel6-x86_64. The v7 and v7-server packages are not +# architecture dependent but the dt, lmbench and stress files are, which +# explains the need for x86_64 in the directory name. +# 3. Create a yum repository from the v7 files by changing into the directory +# where you copied the files and running the command “createrepo -p .”. You +# must run the command from a RHEL6 system. Do not forget the single period +# after createrepo as it tells the command where to create the new yum +# metadata files (in the current directory). This directory should only be +# used to store v7, its dependencies and the repo metadata files created by +# the createrepo command. +# 4. Repeat the previous two steps, if necessary, to copy the required v7 and +# dependency files to your web server and create v7 repositories in unique +# directories for all the architectures you will be certifying on. +# 5. Obtain the kernel-debuginfo and kernel-debuginfo-common-x86_64 files that +# match the version of the kernel you will be certifying on from RHN, +# and copy them to a new HTTP accessible directory on your server. An +# example directory would be /var/www/html/rhel6.1-x86_64-debug +# 6. Create a yum repository from the debug files by changing into the +# directory where you copied the files and running the command +# “createrepo -p .”, as you did in step three. +# 7. Repeat the previous two steps, if necessary, to create additional debug +# package repositories for any different variants (RHEL 6.0, 6.1 etc.) and +# architectures of RHEL that you will be certifying on. +# +# BEGIN OPTIONAL MRG-REALTIME SECTION (RHEL 6 x86_64 ONLY) +# * Prepare the MRG-Realtime yum repositories by copying the entire contents of +# the MRG-Realtime install media (DVD, CD, or mounted ISO files) to NFS or +# HTTP accessible directories on an install server. An example directory +# structure would be /var/www/html/realtime/2.1. +# * Obtain the kernel-rt-debuginfo-common-x86_64 and +# kernel-rt-debuginfo packages for MRG-Realtime that match the version of the +# kernel you will be certifying on from RHN and copy them to the *existing* +# kernel-debug directory you set up in step 5. Re-run the createrepo +# command from step 6 to add them to the yum repository. +# * Obtain the libxslt-python dependency for MRG-Realtime from RHN and copy it +# to a new HTTP accessible directory on your server. An example directory +# would be /var/www/html/realtime/dependencies. +# * Create a yum repository from the dependency file(s) by changing into the +# directory where you copied the files and running the command +# “createrepo -p .”, as you did in step three. +# END OPTIONAL MRG-REALTIME SECTION +# +# 8. Save the kickstart script you are reading now in an HTTP accessible +# directory on your server. We recommend an obvious directory like +# /var/www/html/ks. +# 9. Edit the kickstart script and: +# * Uncomment one of the two install method lines (either URL or NFS +# depending on your environment, but not both) and replace the example +# server information with your own. +# * Replace the example server information on the various server lines +# with your own server information. +# * Uncomment the v7-server line if you will be installing a server. +# * Uncomment the MRG-Realtime lines if you're certifying MRG-Realtime +# and configure them to match your environment. +#10. Start the NFS (if applicable) and/or HTTP services on your server and +# configure them to load on boot. Test that you can browse the install +# tree(s) and the v7 repo(s) and confirm that you can view the kickstart +# file. +#11. Now that you have a working server, repeat steps five and six, if +# necessary, to create kickstart files for all the architectures you +# will be certifying on. Red Hat provides example i386 and x86_64 files. +# Don't forget to give each kickstart file a unique name that incorporates +# the release of RHEL and its architecture and also indicates that the +# file is for v7 installation. +#12. Boot a test system with install media and at the boot prompt, enter the +# following information: +# +# boot: linux ksdevice=bootif ks=http://myserver.mydomain.com/ks/v7-6.1-x86_64.cfg +# +# (Replace the server and kickstart file example text with the location and +# name of your kickstart file. You only need the 'ksdevice=bootif' if your +# system has multiple NICs.) +#13. The system will install, reboot and end at the graphical login. +#14. Log in as certuser with a password of redhat (root cannot log in at the GUI +# for security reasons). You now have a fully configured test system ready +# to run v7. +# End preparation directions + +# Begin v7 kickstart file for RHEL6 x86_64 +install + +# Remove the comment “#” from ONE of the two lines below to choose your install +# method and change the server information to match your own environment. +#url --url http://myserver.mydomain.com/path/to/rhel6-x86_64/bits +#nfs --server=myserver.mydomain.com --dir=/path/to/rhel6-x86_64/bits + +lang en_US.UTF-8 +keyboard us + +# The --device=eth0 is required here to prevent the system from asking +# which NIC to kickstart from. You should also use 'ksdevice=bootif' +# on the boot line if you only have one NIC connected. +network --device eth0 --bootproto dhcp +rootpw redhat +user --name=certuser --password=redhat +firewall --disabled +authconfig --enableshadow --passalgo=sha512 --enablefingerprint +selinux --enforcing +timezone --utc America/New_York +bootloader --location=mbr --driveorder=sda --append="rhgb quiet" + +# Blank all disks and write disk labels, then install to disk /dev/sda ONLY. +# DO NOT RUN THIS KICKSTART ON A SYSTEM WITH DATA YOU WISH TO KEEP +zerombr +clearpart --all --initlabel +ignoredisk --only-use=sda +part /boot --fstype=ext4 --size=500 --ondisk=sda +part swap --size=2048 --ondisk=sda +part / --fstype=ext4 --size=1024 --grow --ondisk=sda +reboot + +# Yum repository for v7, lmbench and stress dependencies. +# Change the next line to match your environment. +repo --name=v7 --baseurl=http://myserver.mydomain.com/v7-rhel6-x86_64 + +# Yum repository for kernel debuginfo dependencies, including optional MRG-Realtime. +# Change the next line to match your environment. +repo --name=rhel6.1-x86_64-debug --baseurl=http://myserver.mydomain.com/rhel6.1-x86_64-debug + +# Yum repository for fence agent package. Change the next line to point +# to the HighAvailability directory in your install tree +repo --name=HighAvailability --baseurl=http://myserver.mydomain.com/path/to/rhel6-x86_64/bits/os/HighAvailability/ + +# Yum repository for MRG-Realtime 2.x packages. Uncomment the next line and change it +# to match your environment if you wish to certify for MRG-Realtime 2.x +#repo --name=MRG-Realtime --baseurl=http://myserver.mydomain.com/path/to/MRG/bits/ + +# Yum repository for MRG-RT dependency (libxslt-python). Uncomment the next line +# and change it to match your environment if you wish to certify for MRG-Realtime 2.x +#repo --name=MRG-Realtime-dependencies --baseurl=http://myserver.mydomain.com/path/to/MRG-dependency/bits/ + +%packages +@additional-devel +@base +@core +@debugging +@basic-desktop +@desktop-debugging +@desktop-platform +@desktop-platform-devel +@development +@emacs +@fonts +@general-desktop +@graphical-admin-tools +@graphics +@input-methods +@internet-browser +@legacy-x +@network-file-system-client +@performance +@perl-runtime +@server-platform +@server-platform-devel +@server-policy +@virtualization +@virtualization-client +@virtualization-platform +@x11 +libXinerama-devel +xorg-x11-proto-devel +startup-notification-devel +libgnomeui-devel +libbonobo-devel +junit +libXau-devel +libgcrypt-devel +popt-devel +libdrm-devel +libXrandr-devel +libxslt-devel +libglade2-devel +gnutls-devel +mtools +pax +python-dmidecode +python-lxml +oddjob +sgpio +genisoimage +wodim +abrt-gui +desktop-file-utils +ant +rpmdevtools +jpackage-utils +rpmlint +certmonger +pam_krb5 +krb5-workstation +nscd +pam_ldap +nss-pam-ldapd +netpbm-progs +libXmu +perl-DBD-SQLite +libvirt-java +dvd+rw-tools +qemu-kvm-tools +xorg-x11-apps +sox +kabi-whitelists +createrepo +mt-st +# Required for fencing test +fence-agents +# Screen utility is helpful for running tests over an SSH session. +screen +# Midnight Commander utility is helpful for debugging test results +# in a non-GUI environment. +mc +# Install v7 and dependencies from our custom repository +v7 +# Uncomment this package only if you are setting up a v7 test server. +#v7-server +# Install the kernel debug packages required for the v7 kdump test +# in v7-1.3-43 and newer from our custom repository +kernel-debuginfo +kernel-debuginfo-common-x86_64 +# Uncomment the following packages if you followed the optional steps +# above and want to certify for MRG-Realtime. +#kernel-rt +#kernel-rt-debuginfo +#kernel-rt-debuginfo-common-x86_64 +#rt-setup +#rtctl +#rteval +#rteval-loads +#rt-tests +#libxslt-python + +%post +# Set DHCP for all interfaces during %post if left unconfigured during install. +if [ `ls -1 /etc/sysconfig/network-scripts/ifcfg-eth* | wc -l` -ge 1 ] + then + for i in /etc/sysconfig/network-scripts/ifcfg-eth* + do + if ! grep -i "bootproto" $i + then + echo "BOOTPROTO=dhcp" >> $i + fi + done +fi +if [ `ls /etc/sysconfig/network-scripts/ifcfg-wlan* | wc -l` -ge 1 ] + then + for i in /etc/sysconfig/network-scripts/ifcfg-wlan* + do + if ! grep -i "bootproto" $i + then + echo "BOOTPROTO=dhcp" >> $i + fi + done +fi +# Force default kernel selection. You'll need to specify EXACTLY which +# kernel you want to boot from. This gets around the problem of the debug +# kernel being set as the default if it's installed. +# +# 1. If installing RHEL 6.0, uncomment next line to add add workaround for +# no /dev/root in %post from BZ 657257. This is fixed in RHEL 6.1 and later +#ln -s `awk '{ if ($2 == "/") print $1; }' /etc/fstab` /dev/root +# +# 2. Use grubby to set the proper boot kernel by uncommenting the line that's +# correct for the version of RHEL you're using. +# RHEL 6.0 +#grubby --set-default /boot/vmlinuz-2.6.32-71.el6.x86_64 +# RHEL 6.1 +#grubby --set-default /boot/vmlinuz-2.6.32-131.0.15.el6.x86_64 +# RHEL 6.2 +#grubby --set-default /boot/vmlinuz-2.6.32-220.el6.x86_64 +# RHEL 6.3 +grubby --set-default /boot/vmlinuz-2.6.32-279.el6.x86_64 +%end + +# End v7 kickstart file for RHEL6 x86_64 + diff --git a/kickstart/write_config.rb b/kickstart/write_config.rb new file mode 100644 index 0000000..91736c5 --- /dev/null +++ b/kickstart/write_config.rb @@ -0,0 +1,12 @@ +#!/usr/bin/ruby +# + +require "json" + +conf_file = "ks.json" +settings = { + "machine_definitions" => "definitions", + "machine_definitions" => "definitions" + }; + +puts JSON.pretty_generate(settings)