blob: 144816e654bc4ab7cd2e617e176a86593e887672 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
.. -*- mode: rst -*-
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]}
|