From 9108ca7a91c290b4f34b99cedf401a205793bc77 Mon Sep 17 00:00:00 2001 From: Gilles Mouchet Date: Mon, 1 Jul 2024 16:29:33 +0200 Subject: [PATCH] fix hostname problem --- files/os/gmo-cfg.sh | 2 +- hosts.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/os/gmo-cfg.sh b/files/os/gmo-cfg.sh index 38d343c..857b381 100644 --- a/files/os/gmo-cfg.sh +++ b/files/os/gmo-cfg.sh @@ -33,7 +33,7 @@ alias sudo='sudo --preserve-env=PATH env' # https://www.petefreitag.com/blog/env if ! is_scp; then if [[ "$USER" == "gilles" || "$USER" == "root" ]]; then - host_domain=$(hostname -d) + host_domain=$(cat /etc/hostname| rev | cut -d. -f1-2 | rev) host_fqdn=$(hostname) host_short=$(hostname -s) ip=$(hostname -I) diff --git a/hosts.yml b/hosts.yml index 66cbeee..8162200 100644 --- a/hosts.yml +++ b/hosts.yml @@ -6,4 +6,4 @@ line: '{{ item }}' state: present with_items: - - '{{ ansible_default_ipv4.address }} {{ ansible_hostname }}.gmotech.net {{ ansible_hostname }}' \ No newline at end of file + - '{{ ansible_default_ipv4.address }} {{ ansible_hostname }} {{ ansible_hostname }}.gmotech.net' \ No newline at end of file