From 574cd711104b4d63dbb1e3620ae2c943bc0813e4 Mon Sep 17 00:00:00 2001
From: Ty Hahn <yosnoop@gmail.com>
Date: Mon, 17 May 2021 01:47:25 +0900
Subject: [PATCH] Allow substring hostname

Let's say the current hostname is 'aaabbbccc'. The current module won't
allow you to change to, for instance, 'aaabbb' since it can grep
'aaabbb' from 'aaabbbccc'.
---
 manifests/init.pp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/manifests/init.pp b/manifests/init.pp
index f358c7b..9333bc4 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -358,7 +358,7 @@ class network (
       '7','8': {
         exec { 'sethostname':
           command => "/usr/bin/hostnamectl set-hostname ${manage_hostname}",
-          unless  => "/usr/bin/hostnamectl status | grep 'Static hostname: ${manage_hostname}'",
+          unless  => "/usr/bin/hostnamectl status | grep 'Static hostname: ${manage_hostname}$'",
         }
       }
       default: {}
-- 
GitLab