blob: 4971f6c9ba73bb9b5995e13c35f5c7d862d981e0 [file] [log] [blame]
Filip Pytloun86506fe2017-01-26 14:36:16 +01001{#-
2 vim: syntax=jinja
3-#}
4{%- from "linux/map.jinja" import network with context -%}
5# hosts(1) file managed by salt-minion(1)
6# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
7
8{%- set hosts = {
9 '127.0.0.1': [
10 'localhost'
11 ],
12 '127.0.1.1': [
13 network.fqdn|default(grains.fqdn),
14 network.hostname|default(grains.nodename)
15 ],
16 '::1': [
Filip Pytloun86506fe2017-01-26 14:36:16 +010017 'ip6-localhost',
18 'ip6-loopback'
19 ],
Filip Pytlound549b452017-03-13 11:20:23 +010020 'fe00::0': [
21 'ip6-localnet',
22 'ip6-mcastprefix'
23 ],
Filip Pytloun86506fe2017-01-26 14:36:16 +010024 'ff02::1': [
25 'ip6-allnodes'
26 ],
27 'ff02::2': [
28 'ip6-allrouters'
29 ],
Filip Pytlound549b452017-03-13 11:20:23 +010030 'ff02::3': [
31 'ip6-allhosts'
32 ],
Filip Pytloun86506fe2017-01-26 14:36:16 +010033} -%}
Ales Komarek417e8c52017-08-25 15:10:29 +020034{%- for name, host in host_dict.iteritems() -%}
Olivier Bourdonf41c3ed2017-09-07 15:01:04 +020035{%- for hname in host.names -%}
36{%- if hname in hosts.get('127.0.1.1', []) -%}
37{%- do hosts.pop('127.0.1.1') -%}
38{%- endif %}
39{%- endfor %}
Filip Pytloun86506fe2017-01-26 14:36:16 +010040{%- do hosts.update({host.address: host.names}) -%}
41{%- endfor %}
42{% for address, entries in hosts|dictsort %}
Olivier Bourdon99c9bcb2017-09-07 17:58:42 +020043{%- if 'linux_hosts.fqdn_sort_filter' in salt.keys() %}
44{%- set sorted_entries = salt['linux_hosts.fqdn_sort_filter'](entries) -%}
45{%- else %}
46{%- set sorted_entries = entries -%}
47{%- endif %}
48{{ address }} {{ sorted_entries|join(' ') }}
Filip Pytloun86506fe2017-01-26 14:36:16 +010049{%- endfor %}