Remove that '.novalocal' line in /etc/hosts, added by cloud-init
It messes up `hostname -f` on Debian, even if there's a correct line further down in /etc/hosts.
This commit is contained in:
parent
3b80ba32c7
commit
0692cabba3
|
@ -57,6 +57,9 @@ if [ ${?} -eq 0 ]; then
|
||||||
sed -i 's/manage_etc_hosts: true/manage_etc_hosts: false/g' /etc/cloud/cloud.cfg
|
sed -i 's/manage_etc_hosts: true/manage_etc_hosts: false/g' /etc/cloud/cloud.cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove potential $hostname.novalocal line from /etc/hosts, added by cloud-init
|
||||||
|
sed -i.bak -e "s/^127\.0\.1\.1 $(hostname)\..*novalocal.*//1" /etc/hosts
|
||||||
|
|
||||||
hostname $cmd_hostname
|
hostname $cmd_hostname
|
||||||
short=`echo ${cmd_hostname} | awk -F. '{print $1}'`
|
short=`echo ${cmd_hostname} | awk -F. '{print $1}'`
|
||||||
echo "127.0.1.1 ${cmd_hostname} ${short}" >> /etc/hosts
|
echo "127.0.1.1 ${cmd_hostname} ${short}" >> /etc/hosts
|
||||||
|
|
Loading…
Reference in a new issue