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