Project

General

Profile

Download (3.86 KB) Statistics
| Branch: | Tag: | Revision:
0fa5d146 Dominic Cleal
<%#
kind: provision
e8e6a960 Dominic Cleal
name: Kickstart RHEL default
0fa5d146 Dominic Cleal
oses:
f1627da8 Dominic Cleal
- RedHat 4
0fa5d146 Dominic Cleal
- RedHat 5
- RedHat 6
f1627da8 Dominic Cleal
- RedHat 7
%>
<%
os_major = @host.operatingsystem.major.to_i
# safemode renderer does not support unary negation
pm_set = @host.puppetmaster.empty? ? false : true
puppet_enabled = pm_set || @host.params['force-puppet']
0fa5d146 Dominic Cleal
%>
cb92c0be Dmitri Dolguikh
install
<%= @mediapath %>
lang en_US.UTF-8
0fa5d146 Dominic Cleal
selinux --enforcing
cb92c0be Dmitri Dolguikh
keyboard us
skipx
6d755dd0 Dominic Cleal
network --bootproto <%= @static ? "static --ip=#{@host.ip} --netmask=#{@host.subnet.mask} --gateway=#{@host.subnet.gateway} --nameserver=#{[@host.subnet.dns_primary,@host.subnet.dns_secondary].reject{|n| n.blank?}.join(',')}" : 'dhcp' %> --hostname <%= @host %>
cb92c0be Dmitri Dolguikh
rootpw --iscrypted <%= root_pass %>
6d755dd0 Dominic Cleal
firewall --<%= os_major >= 6 ? 'service=' : '' %>ssh
cb92c0be Dmitri Dolguikh
authconfig --useshadow --passalgo=sha256 --kickstart
e8e6a960 Dominic Cleal
timezone --utc <%= @host.params['time-zone'] || 'UTC' %>

013ee65a Dominic Cleal
<% if os_major >= 7 && @host.info["parameters"]["realm"] && @host.otp && @host.realm -%>
e8e6a960 Dominic Cleal
realm join --one-time-password=<%= @host.otp %> <%= @host.realm %>
<% end -%>

f1627da8 Dominic Cleal
<% if os_major > 4 -%>
cb92c0be Dmitri Dolguikh
services --disabled 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

repo --name="Extra Packages for Enterprise Linux" --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-<%= @host.operatingsystem.major %>&arch=<%= @host.architecture %>
f1627da8 Dominic Cleal
<% if puppet_enabled && @host.params['enable-puppetlabs-repo'] && @host.params['enable-puppetlabs-repo'] == 'true' -%>
0fa5d146 Dominic Cleal
repo --name=puppetlabs-products --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/products/<%= @host.architecture %>
repo --name=puppetlabs-deps --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/dependencies/<%= @host.architecture %>
<% end -%>
f1627da8 Dominic Cleal
<% end -%>
cb92c0be Dmitri Dolguikh
bootloader --location=mbr --append="nofb quiet splash=quiet" <%= grub_pass %>
f1627da8 Dominic Cleal
<% if os_major == 5 -%>
cb92c0be Dmitri Dolguikh
key --skip
f1627da8 Dominic Cleal
<% end -%>

cb92c0be Dmitri Dolguikh
<% if @dynamic -%>
%include /tmp/diskpart.cfg
<% else -%>
<%= @host.diskLayout %>
<% end -%>

text
reboot

%packages --ignoremissing
yum
dhclient
ntp
wget
@Core
epel-release
f1627da8 Dominic Cleal
<% if puppet_enabled %>
cb92c0be Dmitri Dolguikh
puppet
0fa5d146 Dominic Cleal
<% if @host.params['enable-puppetlabs-repo'] && @host.params['enable-puppetlabs-repo'] == 'true' -%>
puppetlabs-release
<% end -%>
f1627da8 Dominic Cleal
<% end -%>
%end
cb92c0be Dmitri Dolguikh
<% if @dynamic -%>
%pre
<%= @host.diskLayout %>
f1627da8 Dominic Cleal
%end
cb92c0be Dmitri Dolguikh
<% end -%>

%post --nochroot
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on....
/usr/bin/chvt 3
(
cp -va /etc/resolv.conf /mnt/sysimage/etc/resolv.conf
/usr/bin/chvt 1
) 2>&1 | tee /mnt/sysimage/root/install.postnochroot.log
f1627da8 Dominic Cleal
%end
cb92c0be Dmitri Dolguikh
%post
logger "Starting anaconda <%= @host %> postinstall"
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on....
/usr/bin/chvt 3
(
#update local time
echo "updating system time"
6d755dd0 Dominic Cleal
/usr/sbin/ntpdate -sub <%= @host.params['ntp-server'] || '0.fedora.pool.ntp.org' %>
cb92c0be Dmitri Dolguikh
/usr/sbin/hwclock --systohc

6d755dd0 Dominic Cleal
<%= snippet 'redhat_register' %>
cb92c0be Dmitri Dolguikh
013ee65a Dominic Cleal
<% if @host.info["parameters"]["realm"] && @host.otp && @host.realm && @host.realm.realm_type == "FreeIPA" && os_major <= 6 -%>
e8e6a960 Dominic Cleal
<%= snippet "freeipa_register" %>
<% end -%>

cb92c0be Dmitri Dolguikh
# update all the base packages from the updates repository
yum -t -y -e 0 update

f1627da8 Dominic Cleal
<% if puppet_enabled %>
cb92c0be Dmitri Dolguikh
# and add the puppet package
yum -t -y -e 0 install puppet

echo "Configuring puppet"
cat > /etc/puppet/puppet.conf << EOF
6d755dd0 Dominic Cleal
<%= snippet 'puppet.conf' %>
cb92c0be Dmitri Dolguikh
EOF

# Setup puppet to run on system reboot
/sbin/chkconfig --level 345 puppet on

6d755dd0 Dominic Cleal
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
f1627da8 Dominic Cleal
<% end -%>
cb92c0be Dmitri Dolguikh
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 %>
# Sleeping an hour for debug
) 2>&1 | tee /root/install.post.log
exit 0
f1627da8 Dominic Cleal
%end