Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created February 8, 2013 11:38
Show Gist options
  • Select an option

  • Save domcleal/4738376 to your computer and use it in GitHub Desktop.

Select an option

Save domcleal/4738376 to your computer and use it in GitHub Desktop.
kickstart-default
install
<%= @mediapath %>
lang en_GB.UTF-8
selinux --permissive
keyboard uk
skipx
network --bootproto <%= @static ? "static" : "dhcp" %> --hostname <%= @host %>
rootpw --iscrypted <%= root_pass %>
firewall <%= (@host.os.major.to_i > 5) ? "--service=ssh" : "--ssh" %>
authconfig --useshadow --enablemd5
timezone UTC
bootloader --location=mbr --append="nofb quiet splash=quiet" --md5pass=<%= root_pass %>
<% if @dynamic -%>
%include /tmp/diskpart.cfg
<% else -%>
<%= @host.diskLayout %>
<% end -%>
<% if @host.os.name !~ /Fedora/ -%>
key --skip
<% end -%>
text
reboot
%packages
@Core
wget
vim-enhanced
<% if @host.os.major.to_i > 5 -%>
%end
<% end -%>
<% if @dynamic -%>
%pre
<%= @host.diskLayout %>
<% if @host.os.major.to_i > 5 -%>
%end
<% end -%>
<% end -%>
%post --log=/root/install-post.log
logger "Starting anaconda <%= @host %> postinstall"
#changing to VT 3 that we can see whats going on....
/usr/bin/chvt 3
#update local time
echo "updating system time"
/usr/sbin/ntpdate -sub <%= @host.params["ntp-server"] || "ntp" %>
/usr/sbin/hwclock --systohc
<% if @host.os.name !~ /Fedora/ -%>
# install epel if we can
<%= snippet 'epel' %>
<% end -%>
<% if @host.params["puppetlabs"] != "false" -%>
# install puppetlabs if we can
<%= snippet 'puppetlabs_yum' %>
<% end -%>
<% if @host.os.name !~ /Fedora/ -%>
# register to RHN
<%= snippet 'redhat_register' %>
<% end -%>
# install SSH key
<%= snippet 'root_ssh_key' %>
# update all the base packages from the updates repository
# yum -t -y -e 0 update
# and add the puppet package
yum -t -y -e 0 install puppet
<% if @host.params["is_puppetmaster"] -%>
echo "Configuring puppetmaster setup"
yum -t -y -e 0 install autofs nfs-utils
echo '/nfs /etc/auto.nfs' >> /etc/auto.master
echo '* -fstype=nfs4,soft,intr,acregmin=0,acregmax=3,acdirmin=0,acdirmax=3 nfs:/&' > /etc/auto.nfs
chkconfig --level 345 autofs on
cat >> /etc/rc.d/rc.local << EOF
#!/bin/bash
if [ ! -e /root/foreman-installer.log ]; then
/nfs/code/foreman/local/puppet_modules.sh
/nfs/code/foreman/local/foreman-installer.sh > /root/foreman-installer.log
fi
EOF
chmod +x /etc/rc.d/rc.local
<% else -%>
echo "Configuring puppet"
cat > /etc/puppet/puppet.conf << EOF
<%= snippets "puppet.conf" %>
EOF
# Setup puppet to run on system reboot
/sbin/chkconfig --level 345 puppet on
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag --server <%= @host.puppetmaster %> --no-daemonize
<% end -%>
# Disable most things. Puppet will activate these if required.
echo "Disabling various system services"
<% %w{gpm sendmail cups iptables ip6tables auditd arptables_jf xfs pcmcia isdn rawdevices hpoj bluetooth openibd avahi-daemon avahi-dnsconfd hidd hplip pcscd mcstrans yum-updatesd}.each do |service| -%>
/sbin/chkconfig --level 345 <%= service %> off 2>/dev/null
<% end -%>
sync
# 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
<% if @host.os.major.to_i > 5 -%>
%end
<% end -%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment