Saltstack Official Linux Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

37 rindas
910B

  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 %}