# Pitt CS Kickstart file for CentOS 7

#version=RHEL7
install
url --url=http://mirror.cs.pitt.edu/centos/7/os/x86_64
lang en_US.UTF-8
keyboard us

network --bootproto static --device=bond0 --bondslaves=em1,em2 --noipv6 --ip=192.168.1.164 --netmask=255.255.255.0 --bondopts=mode=adaptive-load-balancing,miimon=80,updelay=60000
network --bootproto static --device=em4 --noipv6 --ip=136.142.21.164 --netmask=255.255.255.192 --gateway=136.142.21.129 --nameserver=136.142.57.10,136.142.188.73,136.142.188.76 --hostname=ric-data-09.sci.pitt.edu

rootpw  --iscrypted $6$7sdFE9Ue/kviudcW$Kk6WJ/sq8CBYJCUO/eVCwFDVB.Jfw00Huy3hAzW2byfdh9U32jrTgMvFVXFJaYSt9fFhctdII2ak33s6WOFva/
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512 --enablenis --nisdomain=cs --nisserver=lisa.cs.pitt.edu --enablekrb5 --krb5realm=UNIV.PITT.EDU --krb5kdc=univ.pitt.edu --krb5adminserver=pitt-proddc-01.cssd.pitt.edu
selinux --disabled
timezone America/New_York --isUtc
bootloader --location=mbr --append="crashkernel=auto rhgb quiet"
# 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
clearpart --linux --initlabel

part /boot/efi --fstype=vfat --size=200 --ondisk=sda
part /boot --fstype=xfs --size=1000 --ondisk=sda
part swap --recommended --ondisk=sda
part / --grow --size=1 --ondisk=sda

part /data/01 --fstype=xfs --fsoptions defaults,noatime --ondisk=sdd
part /data/02 --fstype=xfs --fsoptions defaults,noatime --ondisk=sde
part /data/03 --fstype=xfs --fsoptions defaults,noatime --ondisk=sdf
part /data/04 --fstype=xfs --fsoptions defaults,noatime --ondisk=sdg

repo --name="CentOS"  --baseurl=http://mirror.cs.pitt.edu/centos/7/os/x86_64/ --cost=100
repo --name="CentOS 7 - x86_64 - Updates" --baseurl=http://mirror.cs.pitt.edu/centos/7/updates/x86_64/
#repo --name="Extra Packages for Enterprise Linux 7 - x86_64" --baseurl=http://mirror.cs.pitt.edu/epel/7/x86_64/

%packages
%pre
DISKS="/dev/sda"
for DISK in ${DISKS}; do
    parted -s ${DISK} print 2>&1 |grep "unrecognised disk label" > /dev/null
    if [ $? -eq 0 ]; then
        parted -s ${DISK} mklabel msdos
    fi
done
%end
%post
( wget -O /tmp/files.tar http://install.cs.pitt.edu/centos7/proto/files.tar
  cd /
  tar xfp /tmp/files.tar
  sh /tmp/install
  chmod 1777 /tmp
  systemctl disable cups.service
  systemctl disable postfix.service
  systemctl enable ntpd
  systemctl enable sshd
  echo "vm.swappiness = 1" > /etc/sysctl.d/60-swappiness.conf
  echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local
  echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
  chmod +x /etc/rc.d/rc.local
  echo "hdfs    - nofile 32768" >> /etc/security/limits.conf
  echo "mapred  - nofile 32768" >> /etc/security/limits.conf
  echo "hbase   - nofile 32768" >> /etc/security/limits.conf
  echo "hdfs    - nproc  32768" >> /etc/security/limits.conf
  echo "mapred  - nproc  32768" >> /etc/security/limits.conf
  echo "hbase   - nproc  32768" >> /etc/security/limits.conf
  echo "NETWORKING_IPV6=no" >> /etc/sysconfig/network
  echo "IPV6INIT=no" >> /etc/sysconfig/network
  echo "xfs_io -x -c 'resblks 0' /data/01" >> /etc/rc.local
  echo "xfs_io -x -c 'resblks 0' /data/02" >> /etc/rc.local
  echo "xfs_io -x -c 'resblks 0' /data/03" >> /etc/rc.local
  echo "xfs_io -x -c 'resblks 0' /data/04" >> /etc/rc.local
  curl -s http://linux.dell.com/repo/hardware/dsu/bootstrap.cgi | bash
  yum -y install srvadmin-all
  yum -y remove java-1.7.0-openjdk-devel java-1.7.0-openjdk java-1.6.0-openjdk-devel java-1.7.0-openjdk-headless copy-jdk-configs java-1.6.0-openjdk java-1.8.0-openjdk-devel java-1.8.0-openjdk java-1.8.0-openjdk-headless
  curl http://archive.cloudera.com/cm5/redhat/7/x86_64/cm/cloudera-manager.repo -o /etc/yum.repos.d/cloudera-manager.repo
  sync
) 1>/root/post_install.log 2>&1
%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end
