From e48aa45e71b14582503515bd16a92207c7ca1dc0 Mon Sep 17 00:00:00 2001 From: David Cook Date: Wed, 25 Sep 2024 14:09:57 +1000 Subject: [PATCH] Set hostname with a familiar name This makes it much clearer when you SSH into the machine. I wanted to also changed the host_id to use an underscore, like uk_staging, to match our inventory names. But apparently underscores are not allowed for hostnames. And dashes are not allowed in ansible inventory names. --- roles/config/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/config/tasks/main.yml b/roles/config/tasks/main.yml index 754c0b145..c509c433a 100644 --- a/roles/config/tasks/main.yml +++ b/roles/config/tasks/main.yml @@ -1,4 +1,8 @@ --- +- name: "Set hostname" + hostname: + name: "{{ host_id }}" + - name: "Set journal log size limit" # to avoid hard drive filling up! lineinfile: path: /etc/systemd/journald.conf