Prevent cloud-init from overwriting our hostname

This commit is contained in:
Sebastian Haderecker 2019-05-12 01:14:52 +00:00
parent 3b1e4e8402
commit 17073c3a15

View file

@ -680,6 +680,11 @@ fuBANNER "Set hostname"
hostnamectl set-hostname $myHOST hostnamectl set-hostname $myHOST
sed -i 's#127.0.1.1.*#127.0.1.1\t'"$myHOST"'#g' /etc/hosts sed -i 's#127.0.1.1.*#127.0.1.1\t'"$myHOST"'#g' /etc/hosts
# Prevent cloud-init from overwriting our new hostname
if [ -f '/etc/cloud/cloud.cfg' ]; then
sed -i 's/preserve_hostname.*/preserve_hostname: true/g' /etc/cloud/cloud.cfg
fi
# Let's patch cockpit.socket, sshd_config # Let's patch cockpit.socket, sshd_config
fuBANNER "Adjust ports" fuBANNER "Adjust ports"
mkdir -p /etc/systemd/system/cockpit.socket.d mkdir -p /etc/systemd/system/cockpit.socket.d