aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-07-21 10:01:45 +0100
committerGravatar Joe Banks <[email protected]>2024-07-21 10:11:35 +0100
commitabacdeb0580930e763671fb2dbea793a2dcb3c14 (patch)
treeed232b194a2d95684e8771257dff8ea193e3fc77
parentRemove /etc/hosts alias for FQDN to 127.0.0.1 on hosts (diff)
Template hostname in Alloy to the inventory hostname
This maintains previous behaviour in which the hostname would have just been the inventory hostname, but as the hostname is being updated to the FQDN we should explicitly set the inventory_hostname to ensure continuity of logs. Signed-off-by: Joe Banks <[email protected]>
-rw-r--r--ansible/roles/alloy/templates/config.alloy.j22
1 files changed, 1 insertions, 1 deletions
diff --git a/ansible/roles/alloy/templates/config.alloy.j2 b/ansible/roles/alloy/templates/config.alloy.j2
index aecf34c..805d167 100644
--- a/ansible/roles/alloy/templates/config.alloy.j2
+++ b/ansible/roles/alloy/templates/config.alloy.j2
@@ -35,7 +35,7 @@ loki.process "ansible_{{ extra.name }}" {
loki.write "pydis_gateway" {
external_labels = {
- hostname = env("HOSTNAME"),
+ hostname = "{{ inventory_hostname }}",
}
endpoint {
url = "{{ alloy_loki_endpoint }}/loki/api/v1/push"