Saltstack Official Linux Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

50 lines
1.2KB

  1. {#-
  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. {%- set hosts = {
  8. '127.0.0.1': [
  9. 'localhost'
  10. ],
  11. '127.0.1.1': [
  12. network.fqdn|default(grains.fqdn),
  13. network.hostname|default(grains.nodename)
  14. ],
  15. '::1': [
  16. 'ip6-localhost',
  17. 'ip6-loopback'
  18. ],
  19. 'fe00::0': [
  20. 'ip6-localnet',
  21. 'ip6-mcastprefix'
  22. ],
  23. 'ff02::1': [
  24. 'ip6-allnodes'
  25. ],
  26. 'ff02::2': [
  27. 'ip6-allrouters'
  28. ],
  29. 'ff02::3': [
  30. 'ip6-allhosts'
  31. ],
  32. } -%}
  33. {%- for name, host in host_dict.items() -%}
  34. {%- for hname in host.names -%}
  35. {%- if hname in hosts.get('127.0.1.1', []) -%}
  36. {%- do hosts.pop('127.0.1.1') -%}
  37. {%- endif %}
  38. {%- endfor %}
  39. {%- do hosts.update({host.address: host.names}) -%}
  40. {%- endfor %}
  41. {% for address, entries in hosts|dictsort %}
  42. {%- if 'linux_hosts.fqdn_sort_filter' in salt.keys() %}
  43. {%- set sorted_entries = salt['linux_hosts.fqdn_sort_filter'](entries) -%}
  44. {%- else %}
  45. {%- set sorted_entries = entries -%}
  46. {%- endif %}
  47. {{ address }} {{ sorted_entries|join(' ') }}
  48. {%- endfor %}