]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
prep-fog-capture: Set short hostname on boot 835/head
authorDavid Galloway <david.galloway@ibm.com>
Tue, 17 Mar 2026 12:47:15 +0000 (08:47 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Tue, 17 Mar 2026 12:47:15 +0000 (08:47 -0400)
Setting FQDN via `hostname` is not best practice

Signed-off-by: David Galloway <david.galloway@ibm.com>
tools/roles/prep-fog-capture/files/cephlab-set-hostname.sh

index 482df749fd9bf9dda96100331e5db7595b18c155..c3631c7e76d5bad268eb3c104651e60efffb074c 100644 (file)
@@ -57,11 +57,11 @@ reverse_lookup() {
 }
 
 set_hostname() {
-  local fqdn="$1"
+  local shortname="$1"
   if command -v hostnamectl >/dev/null 2>&1; then
-    hostnamectl set-hostname "${fqdn}"
+    hostnamectl set-hostname "${shortname}"
   else
-    hostname "${fqdn}"
+    hostname "${shortname}"
   fi
 }
 
@@ -173,8 +173,8 @@ if [[ -z "${newhostname}" ]]; then
 fi
 
 # Apply hostname + persist
-set_hostname "${newhostname}"
 shorthostname="${newhostname%%.*}"
+set_hostname "${shorthostname}"
 echo "${newhostname}" > /etc/hostname
 
 log "Rewriting /etc/hosts from scratch"