metal/bsp-files/kickstarts/post_pxeboot_controller.cfg
Joseph Richard 9e388d3bc3 Set IPV6_AUTOCONF=no on initial onboot devices
This commit sets IPV6_AUTOCONF=no from the anaconda installer for
all interfaces that are enabled during the initial install.

Once the puppet manifest is applied, and it updates the networking
config scripts for the system, this will be overwritten by that config,
which disables it for all configured interfaces,

IPv6 auto-configuration is causing an issue during backup and restore,
where router advertisements are causing the default route to be deleted,
which causes the calico pod to fail to initialize.

Closes-bug: 1845707
Change-Id: I519ad0d92c66a636df0d10e79c6962296683520d
Signed-off-by: Joseph Richard <joseph.richard@windriver.com>
2019-10-15 17:35:46 -04:00

123 lines
4.3 KiB
INI

%pre --erroronfail
# Source common functions
. /tmp/ks-functions.sh
echo "repo --name=base --baseurl=xxxHTTP_URLxxx/" > /tmp/repo-include
echo "repo --name=updates --baseurl=xxxHTTP_URLxxx/patches/" > /tmp/repo-include
%end
# Repository arguments from %pre
%include /tmp/repo-include
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
# Obtain the boot interface from the PXE boot
BOOTIF=`cat /proc/cmdline |xargs -n1 echo |grep BOOTIF=`
if [ -d /sys/firmware/efi ] ; then
BOOTIF=${BOOTIF#BOOTIF=}
else
BOOTIF=${BOOTIF#BOOTIF=01-}
BOOTIF=${BOOTIF//-/:}
fi
mgmt_dev=none
if [ -n "$BOOTIF" ] ; then
ndev=`ip link show |grep -B 1 $BOOTIF |head -1 |awk '{print $2}' |sed -e 's/://'`
if [ -n "$ndev" ] ; then
mgmt_dev=$ndev
else
report_post_failure_with_msg "ERROR: Unable to determine mgmt interface from BOOTIF=$BOOTIF."
fi
else
report_post_failure_with_msg "ERROR: BOOTIF is not set. Unable to determine mgmt interface."
fi
# Persist the boot device to the platform configuration. This will get
# overwritten when config_controller is run.
echo management_interface=$mgmt_dev >> /etc/platform/platform.conf
# persist the default http port number to platform configuration. This
# will get overwritten when config_controller is run.
echo http_port=8080 >> /etc/platform/platform.conf
# Build networking scripts
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
BROADCAST=127.255.255.255
ONBOOT=yes
IPV6_AUTOCONF=no
NAME=loopback
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$mgmt_dev
DEVICE=$mgmt_dev
BOOTPROTO=dhcp
ONBOOT=yes
IPV6_AUTOCONF=no
EOF
%end
%post --erroronfail
# Source common functions
. /tmp/ks-functions.sh
anaconda_logdir=/var/log/anaconda
mkdir -p $anaconda_logdir
cd /www/pages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p feed/rel-xxxPLATFORM_RELEASExxx/repodata
cd feed/rel-xxxPLATFORM_RELEASExxx
feed_url=xxxHTTP_URLxxx
declare -i cut_dirs=NUM_DIRS
echo "Mirroring software repository (may take several minutes)..." >/dev/console
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/Packages/ -o $anaconda_logdir/rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$cut_dirs $feed_url/repodata/ -o $anaconda_logdir/rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/rpmget_repo.log
wget $feed_url/isolinux.cfg --append $anaconda_logdir/wget_kickstarts.log \
|| report_post_failure_with_logfile $anaconda_logdir/wget_kickstarts.log
echo "Done" >/dev/console
patches_url=xxxHTTP_URLxxx/patches
wget -q --spider ${patches_url}/
if [ $? -eq 0 ]; then
echo "Downloading patches..." >/dev/console
cd /www/pages
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/Packages
mkdir -p updates/rel-xxxPLATFORM_RELEASExxx/repodata
cd updates/rel-xxxPLATFORM_RELEASExxx
declare -i patches_cut_dirs=$((cut_dirs+1))
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/Packages/ -o $anaconda_logdir/patches_rpmget.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget.log
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/repodata/ -o $anaconda_logdir/patches_rpmget_repo.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_repo.log
mkdir -p /opt/patching/metadata
mkdir -p /opt/patching/packages/xxxPLATFORM_RELEASExxx
cd /opt/patching
wget --mirror --no-parent --no-host-directories --reject 'index.html*' --cut-dirs=$patches_cut_dirs $patches_url/metadata/ -o $anaconda_logdir/patches_rpmget_metadata.log \
|| report_post_failure_with_logfile $anaconda_logdir/patches_rpmget_metadata.log
find /www/pages/updates/rel-xxxPLATFORM_RELEASExxx/Packages -name '*.rpm' \
| xargs --no-run-if-empty -I files cp --preserve=all files /opt/patching/packages/xxxPLATFORM_RELEASExxx/
echo "Done" >/dev/console
fi
# Create a uuid specific to this installation
INSTALL_UUID=`uuidgen`
echo $INSTALL_UUID > /www/pages/feed/rel-xxxPLATFORM_RELEASExxx/install_uuid
echo "INSTALL_UUID=$INSTALL_UUID" >> /etc/platform/platform.conf
%end