diskimage-builder/elements/base/install.d/10-cloud-init
Jiri Stransky 1e9cf3a1c8 Remove deprecated overriding of cloud-init defaults
The "set to localhost by default" behavior for manage_etc_hosts has been
deprecated for more than a year now by change
Ia8582883f737548e2911d3f36a1943e5b236281b.

Setting that value to "localhost" is still possible, but it won't be the
default anymore. If the previous behavior of assigning the hostname and
FQDN to 127.0.0.1 is still desired in some environments, it can be
achieved by setting the DIB_CLOUD_INIT_ETC_HOSTS environment variable,
as the deprecation warning message suggested.

Change-Id: I5a19d46e2f305769a0c89c9d25d2e6be02910221
2016-05-23 17:44:32 +02:00

18 lines
368 B
Bash
Executable File

#!/bin/bash
# Tweak the stock ubuntu cloud-init config
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# cloud-init May not actually be installed
mkdir -p /etc/cloud/cloud.cfg.d
if [ -n "${DIB_CLOUD_INIT_ETC_HOSTS:-}" ]; then
dd of=/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg << EOF
manage_etc_hosts: $DIB_CLOUD_INIT_ETC_HOSTS
EOF
fi