Add remove-machine-id element

Leaving /etc/machine-id on the image means that all nodes booted from
this image will have the same machine-id, which is wrong. A new
machine-id will be generated during the first boot. This element can be
used to purge the machine-id from the image.

Change-Id: Idd848cd307c179afa557618f44db34b2fb57d937
Related-Bug: #1672461
Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com>
(cherry picked from commit c7c1da513e)
(cherry picked from commit c95399a43a)
This commit is contained in:
Alex Schultz 2017-03-13 14:35:13 -06:00
parent e1dc548084
commit ee24f5d97b
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,9 @@
=================
remove-machine-id
=================
Removes the hardcoded ``/etc/machine-id`` from the resulting image, so that it
is regenerated during the next boot.
Leaving the file means that e.g. all instances will have the same machine-id.

View File

@ -0,0 +1,8 @@
#!/bin/bash
set -eu
set -o pipefail
# In order to make sure not all nodes have the same machine id, we need to
# remove it from the image and it should be generated on boot. LP#1672461
rm -f /etc/machine-id