From d0bcad1a0681d43709089e4f46a7b0c262bb515e Mon Sep 17 00:00:00 2001 From: Markus Rosenstihl Date: Mon, 12 Feb 2024 17:10:16 +0100 Subject: [PATCH] added hostname setting --- liebchen.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/liebchen.yml b/liebchen.yml index b8a83b1..8fd5f23 100644 --- a/liebchen.yml +++ b/liebchen.yml @@ -184,7 +184,7 @@ - name: Update default dock confuguration command: dconf update - - name: Search for string in file + - name: Search for inventory in file command: cmd: grep -oP inventory_number=\\K\\d+ /etc/inventory_number.cmdline register: result @@ -200,5 +200,19 @@ {{ result.stdout_lines[0] }} when: result.rc == 0 + - name: Search for hostname in file + command: + cmd: grep -oP inventory_number=\\K\\w+ /etc/inventory_number.cmdline + register: result_hostname + # Since it is a reporting task + # which needs to deliver a result in any case + failed_when: result_hostname.rc != 0 and result_hostname.rc != 1 + check_mode: false + changed_when: false + - name: Set hostname + command: hostnamectl set-hostname {{ result_hostname.stdout_lines[0] }} + when: result_hostname.rc == 0 + + - name: Enable login screen after install command: systemctl start systemd-logind.service