install text %include /tmp/source.ks reboot --eject lang en_US.UTF-8 selinux --disabled url --url http://download.mirantis.com/centos-6.4 network --bootproto=dhcp repo --name=Mirantis --mirrorlist=http://download.mirantis.com/epel-fuel-grizzly-3.1/mirantis.mirror keyboard us rootpw r00tme timezone --utc UTC zerombr %include /tmp/bootloader.ks clearpart --all --initlabel %include /tmp/partition.ks %pre #!/bin/sh # hard drives drives="" for drv in `ls -1 /sys/block | grep -e "sd\|hd\|vd"`; do if (grep -q 0 /sys/block/${drv}/removable); then drives="${drives} ${drv}" fi done set ${drives} numdrives=`echo $#` tgtdrive="undefined" if [ ${numdrives} -gt 1 ]; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 while [ "${tgtdrive}" = "undefined" ]; do clear echo echo '********************************************************************************' echo '* W A R N I N G *' echo '* *' echo '* Which of the detected hard drives do you want to be used as *' echo '* installation target? *' echo '* *' echo '********************************************************************************' echo echo "Possible choices: ${drives}" echo read -p "Choose hard drive: " tgtdrive done clear chvt 1 else tgtdrive=`echo ${drives} | sed -e "s/^\s*//" -e "s/\s*$//"` fi # source if test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then echo "harddrive --partition=UUID=will_be_substituted_with_actual_uuid --dir=/" > /tmp/source.ks else echo "cdrom" > /tmp/source.ks fi # bootloader echo "bootloader --location=mbr --driveorder=${tgtdrive}" > /tmp/bootloader.ks # partition echo "partition / --fstype=ext4 --ondisk=${tgtdrive} --size=1 --grow --asprimary" > /tmp/partition.ks echo "partition swap --recommended --ondisk=${tgtdrive}" >> /tmp/partition.ks %end %packages --nobase --excludedocs @Core wget curl crontabs cronie puppet-2.7.19 python-argparse mcollective mcollective-client rubygem-astute yum-plugin-versionlock man yum openssh-clients ntp %post --log=/root/anaconda-post.log #!/bin/sh # Mounting installation source SOURCE=/tmp/source FS=/tmp/fs echo mkdir -p ${SOURCE} mkdir -p ${FS} mount /dev/cdrom ${SOURCE} # Copying Repo to the /var/www/cobbler directory repodir="/var/www" centos_dir="${repodir}/centos/6.4/os/x86_64" mkdir -p ${centos_dir} cp -r ${SOURCE}/images ${centos_dir} cp -r ${SOURCE}/isolinux ${centos_dir} cp -r ${SOURCE}/ubuntu ${repodir} cp -r ${SOURCE}/astute*.gem ${repodir} # Unpacking fuel modules tar zxf ${SOURCE}/fuel-modules.tgz -C /etc/puppet/modules # Prepare local repository specification #rm /etc/yum.repos.d/CentOS*.repo #cat > /etc/yum.repos.d/puppet.repo << EOF #[Puppetlabs-products] #name=Puppetlabs repo #baseurl=http://yum.puppetlabs.com/el/6/products/x86_64/ #gpgcheck=0 #EOF #cat > /etc/yum.repos.d/puppet-dependencies.repo << EOF #[Puppetlabs-dependencies] #name=Puppetlabs Dependencies repo #baseurl=http://yum.puppetlabs.com/el/6/dependencies/x86_64/ #gpgcheck=0 #EOF # Workaround for Hiera-1.2.1 behavior. Place link to required Hiera config file to Puppet directory if [ ! -f /etc/puppet/hiera.yaml ] && [ ! -L /etc/puppet/hiera.yaml ] ; then ln -s /etc/hiera.yaml /etc/puppet/ fi #mkdir -p /etc/httpd/conf.d #cat > /etc/httpd/conf.d/distr.conf << EOF #Alias /ubuntu /var/www/ubuntu #Alias /centos /var/www/centos # # # Options Indexes FollowSymLinks # Order allow,deny # Allow from all # #EOF # Disable GSSAPI in ssh server config sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config # Copying bootstrap_admin_node.sh, chmod it and # adding /etc/init/bootstrap_admin_node.conf cp ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh cp ${SOURCE}/functions.sh /usr/local/lib/functions.sh chmod 0755 /usr/local/sbin/bootstrap_admin_node.sh cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node # Copying cobbler system script to sbin folder ln -s /etc/puppet/modules/cobbler/examples/cobbler_system.py /usr/local/sbin/cobbler_system ln -s /etc/puppet/modules/astute/openstack_system /usr/local/sbin/openstack_system cp /etc/puppet/modules/astute/config.yaml /root/config.yaml # Copying version.yaml file. It contains COMMIT_SHA of last commit. mkdir -p /etc/fuel cp ${SOURCE}/version.yaml /etc/fuel/version.yaml # Prepare custom /etc/issue logon banner and script for changing IP in it cat > /etc/issue << EOF ################################################### # Welcome to the Fuel puppetmaster/cobbler server # ################################################### Server is running on \m platform Fuel management address is: Default administrator login: root Default administrator password: r00tme Please change root password on first login. EOF # Unmounting source umount -f ${SOURCE} rm -rf ${SOURCE} umount -f ${FS} || true rm -rf ${FS} # Enabling/configuring NTPD and ntpdate services echo "server 127.127.1.0" >> /etc/ntp.conf echo "fudge 127.127.1.0 stratum 10" >> /etc/ntp.conf echo "tos orphan 7" >> /etc/ntp.conf chkconfig ntpd on chkconfig ntpdate on # Do not show error message on ntpdate failure. Customers should not be confused # if admin node does not have access to the internet time servers. sed -i /etc/rc.d/init.d/ntpdate -e 's/\([ $RETVAL -eq 0 ] && success || \)failure/\1success/' # Disabling splash sed -i --follow-symlinks -e '/^\skernel/ s/rhgb//' /etc/grub.conf sed -i --follow-symlinks -e '/^\skernel/ s/quiet//' /etc/grub.conf # Uncomment to disable console clearing # sed -i 's/getty/getty --noclear/' /etc/init/tty.conf # Disabling starting first console from start-ttys service sed -i --follow-symlinks -e 's/ACTIVE_CONSOLES=.*/ACTIVE_CONSOLES=\/dev\/tty\[2-6\]/' /etc/sysconfig/init # Copying default bash settings to the root directory cp -f /etc/skel/.bash* /root/ # Changing Cobbler node manifest to deploy %end