DanHam/packer-virt-sysprep

One more cleanup

Closed this issue · 0 comments

I found one more cleanup, which you may add to your collection.

CentOS 7 is creating the network config file with MAC address - which should be removed:

[vagrant@localhost ~]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[vagrant@localhost ~]$ ls -la /etc/sysconfig/network-scripts/ifcfg-e*
-rw-r--r--. 1 root root 161 Mar 27 16:46 /etc/sysconfig/network-scripts/ifcfg-enp0s3

[vagrant@localhost ~]$ cat /etc/sysconfig/network-scripts/ifcfg-enp0s3
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=dhcp
DEVICE=enp0s3
HWADDR=08:00:27:10:68:cd
ONBOOT=yes
TYPE=Ethernet
USERCTL=no

Solution:

sed -i -e "/^HWADDR=/d" -e "/^UUID=/d" /etc/sysconfig/network-scripts/ifcfg-e*

Thanks for the scripts :-)