From 101fdc5c5d015a5466494f78d5c4cb2773a5c280 Mon Sep 17 00:00:00 2001 From: noelmcloughlin Date: Tue, 31 Aug 2021 11:29:21 +0100 Subject: [PATCH] fix(changes): set-fqdn should not alwasy change state --- hostsfile/hostname.sls | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hostsfile/hostname.sls b/hostsfile/hostname.sls index d4ccd18..5c8883e 100644 --- a/hostsfile/hostname.sls +++ b/hostsfile/hostname.sls @@ -4,8 +4,8 @@ {%- set fqdn = grains['id'] %} {%- if grains['os_family'] == 'Debian' %} {% set hostname = fqdn.split('.')[0] %} -{% else %} - {% set hostname = fqdn %} +{%- else %} + {%- set hostname = fqdn %} {% endif %} {%- if grains['os_family'] == 'RedHat' %} @@ -32,6 +32,8 @@ etc-sysconfig-network: - contents: {{ hostname }} - backup: false {% endif %} + - onchanges_in: + - cmd: set-fqdn set-fqdn: cmd.run: