Merge "linux/hostname.sls code sugar fix."
diff --git a/linux/network/hostname.sls b/linux/network/hostname.sls
index dd46586..7b9d342 100644
--- a/linux/network/hostname.sls
+++ b/linux/network/hostname.sls
@@ -1,7 +1,7 @@
{%- from "linux/map.jinja" import network with context %}
{%- if network.enabled %}
-{%- if grains.os_family in ['Arch', 'Debian'] %}
+ {%- if grains.os_family in ['Arch', 'Debian'] %}
linux_hostname_file:
file.managed:
@@ -14,23 +14,23 @@
- watch_in:
- cmd: linux_enforce_hostname
-{%- endif %}
+ {%- endif %}
-{# Change state to proper one, after releasing patch:
- https://github.com/saltstack/salt/pull/45748/files/74599bbdfcf99f45d3a31296887097fade31cbf1
+ {%- if grains['saltversioninfo'] >= [2019, 2] %}
linux_enforce_hostname:
network.system:
- enabled: True
- hostname: {{ network.hostname }}
- apply_hostname: True
- retain_settings: True
-#}
+ {%- else %}
linux_enforce_hostname:
cmd.run:
- name: hostname {{ network.hostname }}
- unless: test "$(hostname)" = "{{ network.hostname }}"
- {%- if grains.get('noservices') %}
+ {%- if grains.get('noservices') %}
- onlyif: /bin/false
+ {%- endif %}
{%- endif %}
{%- endif %}