sampledoc

hostsΒΆ

This is an example of creating /etc/hosts based on metadata.hostname:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
{% python
import socket
import re
ip = socket.gethostbyname(metadata.hostname)

shortname = re.split("\.", metadata.hostname)
%}\
${ip} ${metadata.hostname} ${shortname[0]}

Previous topic

grub.conf

Next topic

iptables

This Page