Kickstart¶
Here is an example kickstart file for RHEL to register to the right channels and install enough puppet to bootstrap you.
WARNING: You must change some things, such as $puppetip, $rhnuser, and $rhnpassword¶
install <%= @mediapath %> lang en_US.UTF-8 <%= "langsupport --default en_US.UTF-8 en_GB.UTF-8 en_US.UTF-8\n" if @osver < 5 -%> <%= "mouse generic3usb --device input/mice\n" if @osver == 3 -%> keyboard us skipx network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= @host %> rootpw --iscrypted <%= root_pass %> firewall --enabled authconfig --useshadow --enablemd5 <%= @osver != 3 and @osver != 4 ? '--disablenis' : '' %> timezone 'America/New York' bootloader --location=mbr --append="nofb quiet splash=quiet <%=ks_console%>" <%= grub_pass %> <% if @dynamic -%> %include /tmp/diskpart.cfg <% else -%> <%= @host.diskLayout %> <% end -%> <% if @osver >= 5 -%> selinux --permissive <% end -%> <%= "key --skip\n" if @osver == 5 -%> text reboot %packages ntp @core @base <% if @dynamic -%> %pre <%= @host.diskLayout %> <% end -%> %post #changing to VT 3 that we can see whats going on.... /usr/bin/chvt 3 #update local time echo "updating system time" /usr/sbin/hwclock --systohc /usr/sbin/ntpdate time.nist.gov logger "Starting anaconda <%= @host.name -%> postinstall" ## ## UGLY DNS HACK echo "$puppetip puppet" >> /etc/hosts # Register to RHN and add channels. /usr/sbin/rhnreg_ks --username=$rhnuser --password=$rhnpassword <% if @osver == 5 -%> /usr/sbin/rhn-channel -a -c rhel-x86_64-server-supplementary-5 -u $rhnuser -p $rhnpassword <% elsif @osver == 6 -%> /usr/sbin/rhn-channel -a -c rhel-x86_64-server-supplementary-6 -u $rhnuser -p $rhnpassword /usr/sbin/rhn-channel -a -c rhel-x86_64-server-optional-6 -u $rhnuser -p $rhnpassword <% end -%> <% if @osver >= 5 -%> cat > /etc/yum.repos.d/puppetlabs.repo << EOF [puppetlabs] name = $releasever - Puppet Labs - <% if @osver == 5 -%> baseurl = http://yum.puppetlabs.com/el/5/products/\$basearch/ <% elsif @osver == 6 -%> baseurl = http://yum.puppetlabs.com/el/6/products/\$basearch/ <% end -%> enabled = 1 protect = 0 gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-reductive gpgcheck = 0 EOF <% end -%> # install epel if we can <%= @epel -%> # update all the base packages from the updates repository yum -t -y -e 0 <% @yumrepo -%> upgrade # and add the puppet and ruby-shadow package yum -t -y -e 0 <% @yumrepo -%> install puppet echo "Configuring puppet" cat > /etc/puppet/puppet.conf << EOF <%= snippets "puppet.conf" -%> EOF # The puppet service will not start without this file unless it is in test/debug mode. Its contents are updated later in the build process. /bin/touch /etc/puppet/namespaceauth.conf # Setup puppet to run on system reboot /sbin/chkconfig --level 345 puppet on # Disable most things. Puppet will activate these if required. echo "Disabling various system services" <% %w{autofs gpm sendmail cups iptables ip6tables auditd arptables_jf xfs pcmcia isdn rawdevices hpoj bluetooth openibd avahi-daemon avahi-dnsconfd hidd hplip pcscd restorecond mcstrans rhnsd yum-updatesd}.each do |service| -%> /sbin/chkconfig --level 345 <%= service %> off 2>/dev/null <% end -%> /usr/sbin/puppetd --config /etc/puppet/puppet.conf -o --tags no_such_tag --server <%= @host.puppetmaster %> --no-daemonize sync <%= snippets "vmware" -%> # Inform the build system that we are done. echo "Informing Foreman that we are built" wget -q -O /dev/null --no-check-certificate <%= foreman_url %> exit 0