Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
660B

  1. {%- from "linux/map.jinja" import network with context %}
  2. {%- if network.enabled %}
  3. {%- if grains.os_family in ['Arch', 'Debian'] %}
  4. linux_hostname_file:
  5. file.managed:
  6. - name: {{ network.hostname_file }}
  7. - source: salt://linux/files/hostname
  8. - template: jinja
  9. - user: root
  10. - group: root
  11. - mode: 644
  12. - watch_in:
  13. - cmd: linux_enforce_hostname
  14. {%- endif %}
  15. linux_enforce_hostname:
  16. cmd.wait:
  17. - name: hostname {{ network.hostname }}
  18. {#
  19. linux_hostname_hosts:
  20. host.present:
  21. - ip: {{ grains.ip4_interfaces[network.get('default_interface', 'eth0')][0] }}
  22. - names:
  23. - {{ network.fqdn }}
  24. - {{ network.hostname }}
  25. #}
  26. {%- endif %}