Host order fix finalisation
diff --git a/linux/network/host.sls b/linux/network/host.sls
index 7049581..22227b6 100644
--- a/linux/network/host.sls
+++ b/linux/network/host.sls
@@ -12,15 +12,17 @@
{%- if host.address in grains.ipv4 %}
-{%- if host.names.0|length > host.names.1|length %}
+{%- if host.names.1 in host.names.0 %}
{%- set before = host.names.1 + " " + host.names.0 %}
{%- set after = host.names.0 + " " + host.names.1 %}
-{%- else %}
+{%- elif host.names.0 in host.names.1 %}
{%- set before = host.names.0 + " " + host.names.1 %}
{%- set after = host.names.1 + " " + host.names.0 %}
{%- endif %}
-mine.send:
+{%- if before is defined and after is defined %}
+
+linux_host_{{ name }}_order_fix:
module.run:
- name: file.replace
- path: /etc/hosts
@@ -33,6 +35,8 @@
{%- endif %}
+{%- endif %}
+
{%- endfor %}
{%- endif %}
\ No newline at end of file