diff --git a/elements/baremetal/README.md b/elements/baremetal/README.md index c94fd3754..b5652fbdb 100644 --- a/elements/baremetal/README.md +++ b/elements/baremetal/README.md @@ -1,4 +1,9 @@ This is the baremetal (IE: real hardware) element. -Currently, this element will extract out the kernel and initial ramdisk of -the built image. +Does the following: + + * Enables stable network interface naming (em1, em2, etc) by + installing the biosdevname and removes any symlinks which may + disable udev rules, etc. + + * extracts the kernel and initial ramdisk of the built image. diff --git a/elements/baremetal/install.d/02-stable-interface-names b/elements/baremetal/install.d/02-stable-interface-names new file mode 100755 index 000000000..32fb19b12 --- /dev/null +++ b/elements/baremetal/install.d/02-stable-interface-names @@ -0,0 +1,25 @@ +#!/bin/bash + +# remove softlink to /dev/null which disables these rules +NET_NAME_SLOT_FILE="/etc/udev/rules.d/80-net-name-slot.rules" +if [ -h $NET_NAME_SLOT_FILE ]; then + rm $NET_NAME_SLOT_FILE +fi + +install-packages biosdevname + +# Fedora/RHEL cloud images may hard code the eth0 interface +# so it boots w/ DHCP. We remove this file here so it +# doesn't interfere w/ stable interface naming +IFCFG_NETSCRIPT="/etc/sysconfig/network-interfaces/ifcfg-eth0" +if [ -f $IFCFG_NETSCRIPT ]; then + rm $IFCFG_NETSCRIPT +fi + +# Ubuntu may hard code the eth0 interface for DHCP +# We remove this file here so it doesn't interfere w/ +# stable interface naming +ENI_ETH0_CFG="/etc/network/interfaces.d/eth0.cfg" +if [ -f $ENI_ETH0_CFG ]; then + rm $ENI_ETH0_CFG +fi