Fix hostnames ordering fix if multiple addresses applies
diff --git a/linux/network/host.sls b/linux/network/host.sls
index f554453..d913c6f 100644
--- a/linux/network/host.sls
+++ b/linux/network/host.sls
@@ -10,9 +10,9 @@
- ip: {{ host.address }}
- names: {{ host.names }}
-{%- if host.address in grains.ipv4 %}
+{%- if host.address in grains.ipv4 and host.names|length > 1 %}
-{%- if host.names|length > 1 and host.names.1 in host.names.0 %}
+{%- if host.names.1 in host.names.0 %}
{%- set before = host.names.1 + " " + host.names.0 %}
{%- set after = host.names.0 + " " + host.names.1 %}
{%- elif host.names.0 in host.names.1 %}
@@ -20,8 +20,6 @@
{%- set after = host.names.1 + " " + host.names.0 %}
{%- endif %}
-{%- if before is defined and after is defined %}
-
linux_host_{{ name }}_order_fix:
module.run:
- name: file.replace
@@ -35,8 +33,6 @@
{%- endif %}
-{%- endif %}
-
{%- endfor %}
{%- endif %}
\ No newline at end of file