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.

9 年之前
9 年之前
9 年之前
9 年之前
123456789101112131415161718192021222324252627282930313233343536
  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. {# Change state to proper one, after releasing patch:
  16. https://github.com/saltstack/salt/pull/45748/files/74599bbdfcf99f45d3a31296887097fade31cbf1
  17. linux_enforce_hostname:
  18. network.system:
  19. - enabled: True
  20. - hostname: {{ network.hostname }}
  21. - apply_hostname: True
  22. - retain_settings: True
  23. #}
  24. linux_enforce_hostname:
  25. cmd.run:
  26. - name: hostname {{ network.hostname }}
  27. - unless: test "$(hostname)" = "{{ network.hostname }}"
  28. {%- if grains.get('noservices') %}
  29. - onlyif: /bin/false
  30. {%- endif %}
  31. {%- endif %}