Replace /etc/machine-id with an empty file

Since these images can be used to create multiple machines, they should
not have a unique machine-id attached to them. Replace /etc/machine-id
with an empty file so that it will be regenerated at boot time.
This commit is contained in:
David Shea 2018-10-05 14:27:28 -04:00 committed by Brian C. Lane
parent 9d73975c9f
commit e401f36496
7 changed files with 28 additions and 0 deletions

View File

@ -31,6 +31,10 @@ services --enabled=sshd,chronyd,cloud-init
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
# tell cloud-init to create the ec2-user account
sed -i 's/cloud-user/ec2-user/' /etc/cloud/cloud.cfg
%end

View File

@ -24,6 +24,10 @@ bootloader --location=none
%post
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
%end
# NOTE Do NOT add any other sections after %packages

View File

@ -24,6 +24,10 @@ bootloader --location=mbr
%post
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
%end
%packages

View File

@ -24,6 +24,10 @@ bootloader --location=mbr
%post
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
%end
%packages

View File

@ -24,6 +24,10 @@ bootloader --location=none
%post
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
%end
# NOTE Do NOT add any other sections after %packages

View File

@ -30,6 +30,10 @@ services --enabled=sshd,chronyd,waagent
%post
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
%end
%packages

View File

@ -27,6 +27,10 @@ services --enabled=sshd,chronyd,vmtoolsd
%post
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
%end
%packages