aboutsummaryrefslogtreecommitdiffstats
path: root/build/f_isoroot/f_kscfg
diff options
context:
space:
mode:
Diffstat (limited to 'build/f_isoroot/f_kscfg')
-rw-r--r--build/f_isoroot/f_kscfg/ks.cfg389
-rw-r--r--build/f_isoroot/f_kscfg/ks.cfg.orig405
2 files changed, 377 insertions, 417 deletions
diff --git a/build/f_isoroot/f_kscfg/ks.cfg b/build/f_isoroot/f_kscfg/ks.cfg
index 941bfdfd0..356a56267 100644
--- a/build/f_isoroot/f_kscfg/ks.cfg
+++ b/build/f_isoroot/f_kscfg/ks.cfg
@@ -1,6 +1,7 @@
install
text
-%include /tmp/source.ks
+#%include /tmp/source.ks
+cdrom
reboot --eject
lang en_US.UTF-8
keyboard us
@@ -12,9 +13,69 @@ selinux --disabled
unsupported_hardware
# SKIP CONFIGURING X
skipx
+repo --name="mos-centos" --baseurl=file:///run/install/repo/mos-centos/ --cost=100
+
# NEVER ever place zerombr here, it breaks automated installation
%include /tmp/bootloader.ks
%include /tmp/partition.ks
+%include /tmp/post_partition.ks
+
+
+
+
+
+%packages --nobase
+@Core
+fuel
+fuel-library
+fuel-dockerctl
+authconfig
+bind-utils
+bridge-utils
+cronie
+crontabs
+curl
+dhcp
+docker
+fuel-bootstrap-cli
+fuel-bootstrap-image
+# NOTE(kozhukalov): We don't need target centos images in 8.0
+# fuel-target-centos-images7.1.1503
+fuelmenu
+fuel-docker-images
+fuel-mirror
+fuel-openstack-metadata
+gdisk
+lrzip
+lsof
+man
+mlocate
+nmap-ncat
+ntp
+ntpdate
+openssh-clients
+policycoreutils
+python-pypcap
+rsync
+puppet
+rubygem-netaddr
+rubygem-openstack
+selinux-policy-targeted
+strace
+sysstat
+system-config-firewall-base
+tcpdump
+telnet
+vim
+virt-what
+wget
+yum
+yum-plugin-priorities
+%end
+
+
+
+
# PREINSTALL SECTION
# HERE ARE COMMANDS THAT WILL BE LAUNCHED BEFORE
@@ -183,20 +244,20 @@ fi
tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//')
# source
-if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
- echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks
+if test -e /dev/disk/by-label/OpenStack_Fuel; then
+ echo "harddrive --partition=LABEL=OpenStack_Fuel --dir=/" > /tmp/source.ks
elif 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
-vgremove -ff os
+vgdisplay -c | cut -d':' -f1 | xargs vgremove -ff
dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10
sleep 3
hdparm -z /dev/${tgtdrive}
parted -s /dev/${tgtdrive} mklabel gpt
-parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0 24
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0% 24
parted -s /dev/${tgtdrive} set 1 bios_grub on
parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224
parted -s /dev/${tgtdrive} set 2 boot on
@@ -212,20 +273,24 @@ if echo ${tgtdrive} | grep -q -e cciss ; then
else
bootdev=${tgtdrive}
fi
-echo > /tmp/partition.ks
-echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
-echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks
-echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks
-echo "volgroup os pv.001" >> /tmp/partition.ks
-echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks
-echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks
+
+cat << EOF > /tmp/partition.ks
+part /boot --onpart=/dev/${bootdev}3
+part /boot/efi --onpart=/dev/${bootdev}2
+part pv.001 --ondisk=${tgtdrive} --size=1 --grow
+part pv.002 --ondisk=${tgtdrive} --size=20000
+volgroup os pv.001
+volgroup docker pv.002
+logvol swap --vgname=os --recommended --name=swap
+logvol / --vgname=os --size=10000 --name=root --fstype=ext4
+logvol /var --vgname=os --size=10000 --name=var --fstype=ext4
+logvol /var/log --vgname=os --size=4000 --grow --name=varlog --fstype=ext4
+EOF
+
# bootloader
-echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+echo "bootloader --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
# Anaconda can not install grub 0.97 on disks which are >4T.
# The reason is that grub does not support such large geometries
@@ -240,60 +305,14 @@ echo "echo \"root (hd0,2)\" >> /tmp/grub.script" >> /tmp/post_partition.ks
echo "echo \"install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf\" >> /tmp/grub.script" >> /tmp/post_partition.ks
echo "echo quit >> /tmp/grub.script" >> /tmp/post_partition.ks
echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch" >> /tmp/post_partition.ks
-
+echo "%end" >> /tmp/post_partition.ks
%end
-%packages --nobase --excludedocs
-@Core
-fuel
-fuel-library >= 7.0
-fuel-dockerctl
-authconfig
-bind-utils
-cronie
-crontabs
-curl
-daemonize
-dhcp
-docker-io
-fuel-bootstrap-image
-fuel-bootstrap-image-builder
-fuel-createmirror
-fuel-target-centos-images6.6
-fuel-package-updates
-fuelmenu
-fuel-docker-images
-gdisk
-lrzip
-lsof
-man
-mlocate
-nmap-ncat
-ntp
-ntpdate
-openssh-clients
-policycoreutils
-python-daemon
-rsync
-ruby21-puppet
-ruby21-rubygem-netaddr
-ruby21-rubygem-openstack
-selinux-policy-targeted
-strace
-subscription-manager
-sysstat
-system-config-firewall-base
-tcpdump
-telnet
-vim-enhanced
-virt-what
-wget
-yum
-yum-plugin-priorities
-%include /tmp/post_partition.ks
-# POSTINSTALL SECTION
+
+
+# POSTINSTALL SECTIONS
# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER
# INSTALLATION ITSELF COMPLETED
@@ -342,13 +361,12 @@ echo -e "${ipaddr} ${hostname} ${short}" >> /etc/hosts
# Mount installation media in chroot
%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
-#!/bin/sh
-
+#!/bin/bash
set -x
-SOURCE="/mnt/sysimage/tmp/source"
+source "/mnt/sysimage/root/anaconda.cmdline.vars"
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+SOURCE="/mnt/sysimage/tmp/source"
mkdir -p "${SOURCE}"
@@ -363,81 +381,32 @@ case "${repo}" in
fi
;;
esac
+%end
+
-%post --log=/root/anaconda-post-after-chroot.log
-#!/bin/bash
-set -x
-function save_cfg {
- scrFile="/etc/sysconfig/network-scripts/ifcfg-$admin_interface"
- search="domain $domain\nsearch $domain"
- sed -i -e 's#^\(HOSTNAME=\).*$#\1'"$hostname"'#' /etc/sysconfig/network
- grep -q "^\s*$ip\s+$hostname" /etc/hosts || echo "$ip $hostname" >> /etc/hosts
- echo "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/dnsmasq.upstream
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/resolv.conf
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream
-
- echo DEVICE=$admin_interface > $scrFile
- echo ONBOOT=yes >> $scrFile
- echo NM_CONTROLLED=no >> $scrFile
- echo HWADDR=$hwaddr >> $scrFile
- echo USERCTL=no >> $scrFile
- echo PEERDNS=no >> $scrFile
- if [ $ip ]; then
- echo BOOTPROTO=static >> $scrFile
- echo IPADDR=$ip >> $scrFile
- echo NETMASK=$netmask >> $scrFile
- else
- echo BOOTPROTO=dhcp >> $scrFile
- fi
- scrDHCPFile="/etc/sysconfig/network-scripts/ifcfg-$dhcp_interface"
- #Ignore gateway and set up DHCP if it is used, otherwise apply it
- if [ $dhcp_interface ] && [ "$dhcp_interface" != "$admin_interface" ]; then
- echo "DEVICE=$dhcp_interface" > $scrDHCPFile
- echo "BOOTPROTO=dhcp" >> $scrDHCPFile
- echo "ONBOOT=yes" >> $scrDHCPFile
- echo "USERCTL=no" >> $scrDHCPFile
- else
- echo GATEWAY=$gw >> /etc/sysconfig/network
- fi
- [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
-}
-# Default FQDN
-hostname="nailgun.mirantis.com"
-
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
-hostname=$hostname
-domain=${hostname#*.}
-ip=$ip
-netmask=$netmask
-gw=$gw
-admin_interface=${admin_interface:-"eth0"}
-hwaddr=`ifconfig $admin_interface | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
-dhcp_interface=$dhcp_interface
-build_images=$build_images
-wait_for_external_config=$wait_for_external_config
-save_cfg
+%post --log=/root/anaconda-post-configure-repos.log
+#!/bin/bash
+set -x
# Mounting installation source
SOURCE=/tmp/source
FS=/tmp/fs
-echo
mkdir -p ${SOURCE}
mkdir -p ${FS}
-if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
- mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE}
+if test -e /dev/disk/by-label/OpenStack_Fuel; then
+ mount /dev/disk/by-label/OpenStack_Fuel ${SOURCE}
elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
mount /dev/disk/by-uuid/will_be_substituted_with_actual_uuid ${FS}
mount -o loop ${FS}/nailgun.iso ${SOURCE}
fi
-OPENSTACK_VERSION=`cat ${SOURCE}/openstack_version`
+# this file is provided by fuel-openstack-metadata package
+OPENSTACK_VERSION=`cat /etc/fuel_openstack_version`
# ----------------------
# UNPACKING REPOSITORIES
@@ -448,10 +417,14 @@ repodir="${wwwdir}/${OPENSTACK_VERSION}"
# Copying Centos files
mkdir -p ${repodir}/centos/x86_64
+mkdir -p ${repodir}/mos-centos/x86_64
cp -r ${SOURCE}/images ${repodir}/centos/x86_64
cp -r ${SOURCE}/isolinux ${repodir}/centos/x86_64
cp -r ${SOURCE}/repodata ${repodir}/centos/x86_64
cp -r ${SOURCE}/Packages ${repodir}/centos/x86_64
+cp -r ${SOURCE}/mos-centos/repodata ${repodir}/mos-centos/x86_64
+cp -r ${SOURCE}/mos-centos/Packages ${repodir}/mos-centos/x86_64
+cp -r ${SOURCE}/extra-repos ${repodir}/
cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64
# Copying Ubuntu files
@@ -469,29 +442,11 @@ touch ${repodir}/ubuntu/x86_64/images/initrd.gz
# make links for backward compatibility
ln -s ${repodir}/centos ${wwwdir}/centos
ln -s ${repodir}/ubuntu ${wwwdir}/ubuntu
+#Make a symlink for mos-centos in /var/www/nailgun in iso/ks.template
+ln -s ${repodir}/mos-centos ${wwwdir}/mos-centos
+ln -s ${repodir}/extra-repos ${wwwdir}/extra-repos
-# --------------------------
-# UNPACKING PUPPET MANIFESTS
-# --------------------------
-
-# create folders
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
-#rm -rf /etc/puppet/modules/
-
-# TODO(ikalnitsky): investigate why we need this
-#cp ${SOURCE}/puppet-slave.tgz ${wwwdir}/
-
-# place modules and manifests
-#tar zxf ${SOURCE}/puppet-slave.tgz -C /etc/puppet/${OPENSTACK_VERSION}/modules
-#cp /etc/puppet/${OPENSTACK_VERSION}/modules/osnailyfacter/examples/site.pp /etc/puppet/${OPENSTACK_VERSION}/manifests/site.pp
-cp ${SOURCE}/centos-versions.yaml ${SOURCE}/ubuntu-versions.yaml /etc/puppet/${OPENSTACK_VERSION}/manifests/
-
-# make links for backward compatibility
-#pushd /etc/puppet
-#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
-#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
-#popd
+mkdir -p ${wwwdir}/targetimages
cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
mkdir -p /var/lib/hiera
@@ -499,12 +454,35 @@ touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml
# Prepare local repository specification
rm /etc/yum.repos.d/CentOS*.repo
+cp ${SOURCE}/extra-repos/extra.repo /etc/yum.repos.d/
cat > /etc/yum.repos.d/nailgun.repo << EOF
[nailgun]
name=Nailgun Local Repo
baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/centos/x86_64
gpgcheck=0
+[mos]
+name=MOS Local Repo
+baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/mos-centos/x86_64
+gpgcheck=0
EOF
+%end
+
+
+
+
+
+%post --log=/root/anaconda-post-configure-sysconfig.log
+#!/bin/bash
+set -x
+
+source "/root/anaconda.cmdline.vars"
+SOURCE=/tmp/source
+
+# Set correct docker volume group
+echo "VG=docker" >> /etc/sysconfig/docker-storage-setup
+
+# Disable create iptables rules by docker
+echo "DOCKER_NETWORK_OPTIONS=--iptables=false" > /etc/sysconfig/docker-network
# Disable subscription-manager plugins
sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/product-id.conf || :
@@ -523,19 +501,16 @@ All environments use online repositories by default.
Use the following commands to create local repositories
on master node and change default repository settings:
-* CentOS: fuel-package-updates (see --help for options)
-* Ubuntu: fuel-createmirror (see --help for options)
+* CentOS: fuel-mirror (see --help for options)
+* Ubuntu: fuel-mirror (see --help for options)
Please refer to the following guide for more information:
https://docs.mirantis.com/openstack/fuel/fuel-7.0/reference-architecture.html#fuel-rep-mirror
EOF
-# 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
-chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh
-cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf
+# Install bootstrap_admin_node.sh and enabling it
+install -m 0777 -D ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh
echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node
# Copying version.yaml file. It contains COMMIT_SHA of last commit.
@@ -549,32 +524,31 @@ cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_v
# Generete Fuel UUID
uuidgen > /etc/fuel/fuel-uuid
-# Run fuel menu
-[ -z "$showmenu" ] && showmenu="no"
-
-# Pause during bootstrap_admin_node to wait for external config
-[ -z "$wait_for_external_config" ] && wait_for_external_config="no"
-
-
# Prepare bootstrap_admin_node config
cat > /etc/fuel/bootstrap_admin_node.conf << EOF
#Set to yes to run Fuel Setup
#Set to no to accept default settings
-ADMIN_INTERFACE=${admin_interface}
-showmenu=${showmenu}
-wait_for_external_config=${wait_for_external_config}
+ADMIN_INTERFACE=${adminif}
+showmenu=${showmenu:-no}
+wait_for_external_config=${wait_for_external_config:-no}
EOF
# Prepare custom /etc/issue logon banner and script for changing IP in it
-cat > /etc/issue << EOF
+# We can have several interface naming schemes applied and several interface
+# UI will listen on
+ipstr=""
+NL=$'\n'
+for ip in `ip -o -4 a | grep -e "e[nt][hopsx].*" | awk '{print \$4 }' | cut -d/ -f1`; do
+ ipstr="${ipstr}https://${ip}:8443${NL}"
+done
+cat > /etc/issue <<EOF
#########################################
# Welcome to the Fuel server #
#########################################
Server is running on \m platform
Fuel UI is available on:
-https://:8443
-
+$ipstr
Default administrator login: root
Default administrator password: r00tme
@@ -585,31 +559,6 @@ Please change root password on first login.
EOF
-
-cat >> '/etc/rc.local' << EOF
-first=yes
-for ip in \$(ip -o -4 addr | grep "eth." | awk '{print \$4 }' | cut -d/ -f1); do
-if [ "\$first" = "yes" ]; then
- ipstr="Fuel UI is available on: https://\$ip:8443"
- first=no
-else
- ipstr=\$(printf "%s\n%25s%s" "\$ipstr" " " "https://\$ip:8443")
-fi
-done
-tmpissue=\$(mktemp)
-while read -r line; do
- if [[ "\$line" =~ "Fuel UI is available on" ]]; then
- echo -e "\$ipstr" >> \$tmpissue
- elif [[ "\$line" =~ :8443$ ]]; then
- :
- else
- echo -e "\$line" >> \$tmpissue
- fi
-done < /etc/issue
-mv "\$tmpissue" /etc/issue
-
-EOF
-
######### OPNFV addition BEGIN ############
# Copy data into /opt/opnfv
# TODO: This ought to be a package instead!
@@ -627,26 +576,50 @@ rm -rf ${FS}
echo "tos orphan 7" >> /etc/ntp.conf
-# 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
-
-# Disabling 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
+sed -i --follow-symlinks -e '/^\slinux16/ s/rhgb/debug/' /boot/grub2/grub.cfg
# Copying default bash settings to the root directory
cp -f /etc/skel/.bash* /root/
# Blacklist i2c_piix4 module for VirtualBox so it does not create kernel errors
-[[ $(virt-what) = "virtualbox" ]] && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+(virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+
+# Blacklist intel_rapl module for VirtualBox so it does not create kernel errors
+(virt-what | fgrep -q "virtualbox") && echo "blacklist intel_rapl" > /etc/modprobe.d/blacklist-intel-rapl.conf
+
+# Disable sshd until after Fuel Setup if not running on VirtualBox
+# TODO(mattymo): Remove VBox exception after LP#1487047 is fixed
+(virt-what | fgrep -q "virtualbox") || systemctl disable sshd
+
+%end
+
+
+
+
+%post --log=/root/anaconda-post-configure-autologon.log
+#!/bin/bash
+set -x
+
+# Enable once root autologin for initial setup
+mkdir -p /etc/systemd/system/getty@tty1.service.d/
+cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << 'EOF'
+[Service]
+ExecStart=
+ExecStart=-/sbin/agetty --autologin root --noclear %I 115200 linux
+EOF
+
+# Exec bootstrap_admin_node.sh if autologin enabled
+cat >> /root/.bashrc << 'EOF'
+if [[ "$(tty)" == "/dev/tty1" && -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]]; then
+ rm -Rf "/etc/systemd/system/getty@tty1.service.d"
+ /bin/systemctl daemon-reload
+ if [ -x /usr/local/sbin/bootstrap_admin_node.sh ]; then
+ exec /usr/local/sbin/bootstrap_admin_node.sh
+ fi
+fi
+EOF
%end
diff --git a/build/f_isoroot/f_kscfg/ks.cfg.orig b/build/f_isoroot/f_kscfg/ks.cfg.orig
index e9c8ad588..0305aa77e 100644
--- a/build/f_isoroot/f_kscfg/ks.cfg.orig
+++ b/build/f_isoroot/f_kscfg/ks.cfg.orig
@@ -1,6 +1,7 @@
install
text
-%include /tmp/source.ks
+#%include /tmp/source.ks
+cdrom
reboot --eject
lang en_US.UTF-8
keyboard us
@@ -12,9 +13,69 @@ selinux --disabled
unsupported_hardware
# SKIP CONFIGURING X
skipx
+repo --name="mos-centos" --baseurl=file:///run/install/repo/mos-centos/ --cost=100
+
# NEVER ever place zerombr here, it breaks automated installation
%include /tmp/bootloader.ks
%include /tmp/partition.ks
+%include /tmp/post_partition.ks
+
+
+
+
+
+%packages --nobase
+@Core
+fuel
+fuel-library
+fuel-dockerctl
+authconfig
+bind-utils
+bridge-utils
+cronie
+crontabs
+curl
+dhcp
+docker
+fuel-bootstrap-cli
+fuel-bootstrap-image
+# NOTE(kozhukalov): We don't need target centos images in 8.0
+# fuel-target-centos-images7.1.1503
+fuelmenu
+fuel-docker-images
+fuel-mirror
+fuel-openstack-metadata
+gdisk
+lrzip
+lsof
+man
+mlocate
+nmap-ncat
+ntp
+ntpdate
+openssh-clients
+policycoreutils
+python-pypcap
+rsync
+puppet
+rubygem-netaddr
+rubygem-openstack
+selinux-policy-targeted
+strace
+sysstat
+system-config-firewall-base
+tcpdump
+telnet
+vim
+virt-what
+wget
+yum
+yum-plugin-priorities
+%end
+
+
+
+
# PREINSTALL SECTION
# HERE ARE COMMANDS THAT WILL BE LAUNCHED BEFORE
@@ -183,20 +244,20 @@ fi
tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//')
# source
-if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
- echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks
+if test -e /dev/disk/by-label/OpenStack_Fuel; then
+ echo "harddrive --partition=LABEL=OpenStack_Fuel --dir=/" > /tmp/source.ks
elif 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
-vgremove -ff os
+vgdisplay -c | cut -d':' -f1 | xargs vgremove -ff
dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10
sleep 3
hdparm -z /dev/${tgtdrive}
parted -s /dev/${tgtdrive} mklabel gpt
-parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0 24
+parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0% 24
parted -s /dev/${tgtdrive} set 1 bios_grub on
parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224
parted -s /dev/${tgtdrive} set 2 boot on
@@ -212,20 +273,24 @@ if echo ${tgtdrive} | grep -q -e cciss ; then
else
bootdev=${tgtdrive}
fi
-echo > /tmp/partition.ks
-echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
-echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks
-echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks
-echo "volgroup os pv.001" >> /tmp/partition.ks
-echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks
-echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks
+
+cat << EOF > /tmp/partition.ks
+part /boot --onpart=/dev/${bootdev}3
+part /boot/efi --onpart=/dev/${bootdev}2
+part pv.001 --ondisk=${tgtdrive} --size=1 --grow
+part pv.002 --ondisk=${tgtdrive} --size=20000
+volgroup os pv.001
+volgroup docker pv.002
+logvol swap --vgname=os --recommended --name=swap
+logvol / --vgname=os --size=10000 --name=root --fstype=ext4
+logvol /var --vgname=os --size=10000 --name=var --fstype=ext4
+logvol /var/log --vgname=os --size=4000 --grow --name=varlog --fstype=ext4
+EOF
+
# bootloader
-echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+echo "bootloader --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
# Anaconda can not install grub 0.97 on disks which are >4T.
# The reason is that grub does not support such large geometries
@@ -240,60 +305,14 @@ echo "echo \"root (hd0,2)\" >> /tmp/grub.script" >> /tmp/post_partition.ks
echo "echo \"install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf\" >> /tmp/grub.script" >> /tmp/post_partition.ks
echo "echo quit >> /tmp/grub.script" >> /tmp/post_partition.ks
echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch" >> /tmp/post_partition.ks
-
+echo "%end" >> /tmp/post_partition.ks
%end
-%packages --nobase --excludedocs
-@Core
-fuel
-fuel-library >= 7.0
-fuel-dockerctl
-authconfig
-bind-utils
-cronie
-crontabs
-curl
-daemonize
-dhcp
-docker-io
-fuel-bootstrap-image
-fuel-bootstrap-image-builder
-fuel-createmirror
-fuel-target-centos-images6.6
-fuel-package-updates
-fuelmenu
-fuel-docker-images
-gdisk
-lrzip
-lsof
-man
-mlocate
-nmap-ncat
-ntp
-ntpdate
-openssh-clients
-policycoreutils
-python-daemon
-rsync
-ruby21-puppet
-ruby21-rubygem-netaddr
-ruby21-rubygem-openstack
-selinux-policy-targeted
-strace
-subscription-manager
-sysstat
-system-config-firewall-base
-tcpdump
-telnet
-vim-enhanced
-virt-what
-wget
-yum
-yum-plugin-priorities
-%include /tmp/post_partition.ks
-# POSTINSTALL SECTION
+
+
+# POSTINSTALL SECTIONS
# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER
# INSTALLATION ITSELF COMPLETED
@@ -342,13 +361,12 @@ echo -e "${ipaddr} ${hostname} ${short}" >> /etc/hosts
# Mount installation media in chroot
%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
-#!/bin/sh
-
+#!/bin/bash
set -x
-SOURCE="/mnt/sysimage/tmp/source"
+source "/mnt/sysimage/root/anaconda.cmdline.vars"
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+SOURCE="/mnt/sysimage/tmp/source"
mkdir -p "${SOURCE}"
@@ -363,81 +381,32 @@ case "${repo}" in
fi
;;
esac
+%end
-%post --log=/root/anaconda-post-after-chroot.log
-#!/bin/bash
-set -x
-function save_cfg {
- scrFile="/etc/sysconfig/network-scripts/ifcfg-$admin_interface"
- search="domain $domain\nsearch $domain"
- sed -i -e 's#^\(HOSTNAME=\).*$#\1'"$hostname"'#' /etc/sysconfig/network
- grep -q "^\s*$ip\s+$hostname" /etc/hosts || echo "$ip $hostname" >> /etc/hosts
- echo "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/dnsmasq.upstream
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/resolv.conf
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream
-
- echo DEVICE=$admin_interface > $scrFile
- echo ONBOOT=yes >> $scrFile
- echo NM_CONTROLLED=no >> $scrFile
- echo HWADDR=$hwaddr >> $scrFile
- echo USERCTL=no >> $scrFile
- echo PEERDNS=no >> $scrFile
- if [ $ip ]; then
- echo BOOTPROTO=static >> $scrFile
- echo IPADDR=$ip >> $scrFile
- echo NETMASK=$netmask >> $scrFile
- else
- echo BOOTPROTO=dhcp >> $scrFile
- fi
- scrDHCPFile="/etc/sysconfig/network-scripts/ifcfg-$dhcp_interface"
- #Ignore gateway and set up DHCP if it is used, otherwise apply it
- if [ $dhcp_interface ] && [ "$dhcp_interface" != "$admin_interface" ]; then
- echo "DEVICE=$dhcp_interface" > $scrDHCPFile
- echo "BOOTPROTO=dhcp" >> $scrDHCPFile
- echo "ONBOOT=yes" >> $scrDHCPFile
- echo "USERCTL=no" >> $scrDHCPFile
- else
- echo GATEWAY=$gw >> /etc/sysconfig/network
- fi
- [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
-}
-# Default FQDN
-hostname="nailgun.mirantis.com"
-
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
-hostname=$hostname
-domain=${hostname#*.}
-ip=$ip
-netmask=$netmask
-gw=$gw
-admin_interface=${admin_interface:-"eth0"}
-hwaddr=`ifconfig $admin_interface | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
-dhcp_interface=$dhcp_interface
-build_images=$build_images
-wait_for_external_config=$wait_for_external_config
-save_cfg
+
+%post --log=/root/anaconda-post-configure-repos.log
+#!/bin/bash
+set -x
# Mounting installation source
SOURCE=/tmp/source
FS=/tmp/fs
-echo
mkdir -p ${SOURCE}
mkdir -p ${FS}
-if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
- mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE}
+if test -e /dev/disk/by-label/OpenStack_Fuel; then
+ mount /dev/disk/by-label/OpenStack_Fuel ${SOURCE}
elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
mount /dev/disk/by-uuid/will_be_substituted_with_actual_uuid ${FS}
mount -o loop ${FS}/nailgun.iso ${SOURCE}
fi
-OPENSTACK_VERSION=`cat ${SOURCE}/openstack_version`
+# this file is provided by fuel-openstack-metadata package
+OPENSTACK_VERSION=`cat /etc/fuel_openstack_version`
# ----------------------
# UNPACKING REPOSITORIES
@@ -448,10 +417,14 @@ repodir="${wwwdir}/${OPENSTACK_VERSION}"
# Copying Centos files
mkdir -p ${repodir}/centos/x86_64
+mkdir -p ${repodir}/mos-centos/x86_64
cp -r ${SOURCE}/images ${repodir}/centos/x86_64
cp -r ${SOURCE}/isolinux ${repodir}/centos/x86_64
cp -r ${SOURCE}/repodata ${repodir}/centos/x86_64
cp -r ${SOURCE}/Packages ${repodir}/centos/x86_64
+cp -r ${SOURCE}/mos-centos/repodata ${repodir}/mos-centos/x86_64
+cp -r ${SOURCE}/mos-centos/Packages ${repodir}/mos-centos/x86_64
+cp -r ${SOURCE}/extra-repos ${repodir}/
cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64
# Copying Ubuntu files
@@ -469,29 +442,11 @@ touch ${repodir}/ubuntu/x86_64/images/initrd.gz
# make links for backward compatibility
ln -s ${repodir}/centos ${wwwdir}/centos
ln -s ${repodir}/ubuntu ${wwwdir}/ubuntu
+#Make a symlink for mos-centos in /var/www/nailgun in iso/ks.template
+ln -s ${repodir}/mos-centos ${wwwdir}/mos-centos
+ln -s ${repodir}/extra-repos ${wwwdir}/extra-repos
-# --------------------------
-# UNPACKING PUPPET MANIFESTS
-# --------------------------
-
-# create folders
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
-#rm -rf /etc/puppet/modules/
-
-# TODO(ikalnitsky): investigate why we need this
-#cp ${SOURCE}/puppet-slave.tgz ${wwwdir}/
-
-# place modules and manifests
-#tar zxf ${SOURCE}/puppet-slave.tgz -C /etc/puppet/${OPENSTACK_VERSION}/modules
-#cp /etc/puppet/${OPENSTACK_VERSION}/modules/osnailyfacter/examples/site.pp /etc/puppet/${OPENSTACK_VERSION}/manifests/site.pp
-cp ${SOURCE}/centos-versions.yaml ${SOURCE}/ubuntu-versions.yaml /etc/puppet/${OPENSTACK_VERSION}/manifests/
-
-# make links for backward compatibility
-#pushd /etc/puppet
-#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
-#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
-#popd
+mkdir -p ${wwwdir}/targetimages
cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
mkdir -p /var/lib/hiera
@@ -499,12 +454,35 @@ touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml
# Prepare local repository specification
rm /etc/yum.repos.d/CentOS*.repo
+cp ${SOURCE}/extra-repos/extra.repo /etc/yum.repos.d/
cat > /etc/yum.repos.d/nailgun.repo << EOF
[nailgun]
name=Nailgun Local Repo
baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/centos/x86_64
gpgcheck=0
+[mos]
+name=MOS Local Repo
+baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/mos-centos/x86_64
+gpgcheck=0
EOF
+%end
+
+
+
+
+
+%post --log=/root/anaconda-post-configure-sysconfig.log
+#!/bin/bash
+set -x
+
+source "/root/anaconda.cmdline.vars"
+SOURCE=/tmp/source
+
+# Set correct docker volume group
+echo "VG=docker" >> /etc/sysconfig/docker-storage-setup
+
+# Disable create iptables rules by docker
+echo "DOCKER_NETWORK_OPTIONS=--iptables=false" > /etc/sysconfig/docker-network
# Disable subscription-manager plugins
sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/product-id.conf || :
@@ -523,19 +501,16 @@ All environments use online repositories by default.
Use the following commands to create local repositories
on master node and change default repository settings:
-* CentOS: fuel-package-updates (see --help for options)
-* Ubuntu: fuel-createmirror (see --help for options)
+* CentOS: fuel-mirror (see --help for options)
+* Ubuntu: fuel-mirror (see --help for options)
Please refer to the following guide for more information:
https://docs.mirantis.com/openstack/fuel/fuel-7.0/reference-architecture.html#fuel-rep-mirror
EOF
-# 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
-chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh
-cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf
+# Install bootstrap_admin_node.sh and enabling it
+install -m 0777 -D ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh
echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node
# Copying version.yaml file. It contains COMMIT_SHA of last commit.
@@ -549,32 +524,31 @@ cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_v
# Generete Fuel UUID
uuidgen > /etc/fuel/fuel-uuid
-# Run fuel menu
-[ -z "$showmenu" ] && showmenu="no"
-
-# Pause during bootstrap_admin_node to wait for external config
-[ -z "$wait_for_external_config" ] && wait_for_external_config="no"
-
-
# Prepare bootstrap_admin_node config
cat > /etc/fuel/bootstrap_admin_node.conf << EOF
#Set to yes to run Fuel Setup
#Set to no to accept default settings
-ADMIN_INTERFACE=${admin_interface}
-showmenu=${showmenu}
-wait_for_external_config=${wait_for_external_config}
+ADMIN_INTERFACE=${adminif}
+showmenu=${showmenu:-no}
+wait_for_external_config=${wait_for_external_config:-no}
EOF
# Prepare custom /etc/issue logon banner and script for changing IP in it
-cat > /etc/issue << EOF
+# We can have several interface naming schemes applied and several interface
+# UI will listen on
+ipstr=""
+NL=$'\n'
+for ip in `ip -o -4 a | grep -e "e[nt][hopsx].*" | awk '{print \$4 }' | cut -d/ -f1`; do
+ ipstr="${ipstr}https://${ip}:8443${NL}"
+done
+cat > /etc/issue <<EOF
#########################################
# Welcome to the Fuel server #
#########################################
Server is running on \m platform
Fuel UI is available on:
-https://:8443
-
+$ipstr
Default administrator login: root
Default administrator password: r00tme
@@ -585,32 +559,6 @@ Please change root password on first login.
EOF
-
-cat >> '/etc/rc.local' << EOF
-first=yes
-for ip in \$(ip -o -4 addr | grep "eth." | awk '{print \$4 }' | cut -d/ -f1); do
-if [ "\$first" = "yes" ]; then
- ipstr="Fuel UI is available on: https://\$ip:8443"
- first=no
-else
- ipstr=\$(printf "%s\n%25s%s" "\$ipstr" " " "https://\$ip:8443")
-fi
-done
-tmpissue=\$(mktemp)
-while read -r line; do
- if [[ "\$line" =~ "Fuel UI is available on" ]]; then
- echo -e "\$ipstr" >> \$tmpissue
- elif [[ "\$line" =~ :8443$ ]]; then
- :
- else
- echo -e "\$line" >> \$tmpissue
- fi
-done < /etc/issue
-mv "\$tmpissue" /etc/issue
-
-EOF
-
-
# Unmounting source
umount -f ${SOURCE}
rm -rf ${SOURCE}
@@ -620,24 +568,63 @@ rm -rf ${FS}
echo "tos orphan 7" >> /etc/ntp.conf
-# 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
-
-# Disabling 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
+sed -i --follow-symlinks -e '/^\slinux16/ s/rhgb/debug/' /boot/grub2/grub.cfg
# Copying default bash settings to the root directory
cp -f /etc/skel/.bash* /root/
# Blacklist i2c_piix4 module for VirtualBox so it does not create kernel errors
-[[ $(virt-what) = "virtualbox" ]] && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+(virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+
+# Blacklist intel_rapl module for VirtualBox so it does not create kernel errors
+(virt-what | fgrep -q "virtualbox") && echo "blacklist intel_rapl" > /etc/modprobe.d/blacklist-intel-rapl.conf
+
+# Disable sshd until after Fuel Setup if not running on VirtualBox
+# TODO(mattymo): Remove VBox exception after LP#1487047 is fixed
+(virt-what | fgrep -q "virtualbox") || systemctl disable sshd
+
+%end
+
+
+
+
+
+%post --log=/root/anaconda-post-configure-autologon.log
+#!/bin/bash
+set -x
+
+# Enable once root autologin for initial setup
+mkdir -p /etc/systemd/system/getty@tty1.service.d/
+cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << 'EOF'
+[Service]
+ExecStart=
+ExecStart=-/sbin/agetty --autologin root --noclear %I 115200 linux
+EOF
+# Exec bootstrap_admin_node.sh if autologin enabled
+cat >> /root/.bashrc << 'EOF'
+if [[ "$(tty)" == "/dev/tty1" && -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]]; then
+ rm -Rf "/etc/systemd/system/getty@tty1.service.d"
+ /bin/systemctl daemon-reload
+ if [ -x /usr/local/sbin/bootstrap_admin_node.sh ]; then
+ exec /usr/local/sbin/bootstrap_admin_node.sh
+ fi
+fi
+EOF
+%end
+
+
+%post --nochroot --log=/mnt/sysimage/root/anaconda-post-interface-settings.log
+#!/bin/bash
+set -x
+
+source "/mnt/sysimage/root/anaconda.cmdline.vars"
+
+if [[ ! -z $adminif ]]; then
+ rm -f /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${ifname%%:*}
+ sed "s/${ifname%%:*}/${adminif}/g" \
+ /etc/sysconfig/network-scripts/ifcfg-${ifname%%:*} > \
+ /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${adminif}
+fi
%end \ No newline at end of file