From d5ba3060812c4d86dbd0d44903767261286ddcb7 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 5 Apr 2025 18:28:20 +0200 Subject: [PATCH] Replaced HOST and HOSTNAME variable through hostname command to make it more distribution indepentend --- .../templates/systemd-notifier-telegram.sh.j2 | 2 +- roles/user/templates/bashrc.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/systemd-notifier-telegram/templates/systemd-notifier-telegram.sh.j2 b/roles/systemd-notifier-telegram/templates/systemd-notifier-telegram.sh.j2 index 64871a30..c2177b82 100644 --- a/roles/systemd-notifier-telegram/templates/systemd-notifier-telegram.sh.j2 +++ b/roles/systemd-notifier-telegram/templates/systemd-notifier-telegram.sh.j2 @@ -1,2 +1,2 @@ #!/bin/bash -/usr/bin/curl -s -X POST https://api.telegram.org/bot{{ telegram_bot_token }}/sendMessage -d chat_id={{ telegram_chat_id }} -d text="service $1 on $HOST failed" +/usr/bin/curl -s -X POST https://api.telegram.org/bot{{ telegram_bot_token }}/sendMessage -d chat_id={{ telegram_chat_id }} -d text="service $1 on $(hostname) failed" diff --git a/roles/user/templates/bashrc.j2 b/roles/user/templates/bashrc.j2 index fd444b09..274adfc9 100644 --- a/roles/user/templates/bashrc.j2 +++ b/roles/user/templates/bashrc.j2 @@ -20,7 +20,7 @@ clear PRIMARY_IP=$(ip route get 8.8.8.8 2>/dev/null | awk '{print $7}' | head -n1) # Print welcome message -echo -e "${HEADER_COLOR}Welcome, $USER on ${HOSTNAME_COLOR}$HOSTNAME!${RESET_COLOR}" +echo -e "${HEADER_COLOR}Welcome, $USER on ${HOSTNAME_COLOR}$(hostname)!${RESET_COLOR}" echo -e "Primary IP Address: ${PRIMARY_IP}" echo -e "${HEADER_COLOR}Today is $(date +"%A, %d.%m.%Y %T")${RESET_COLOR}" echo -e "\033[94mPowered by: CyMaIS - Cyber Master Infrastructure Solutions!"