extract the inventory number properly

This commit is contained in:
Markus Rosenstihl 2024-02-12 15:13:36 +01:00
parent eb09196d26
commit e5b9b9b702

View File

@ -184,10 +184,21 @@
- name: Update default dock confuguration
command: dconf update
- name: Extract inventory number
command: grep -oP inventory_number=\K\d+ /etc/inventory_number.cmdline > /ect/inventory_number
- name: Search for string in file
command:
cmd: grep -oP inventory_number=\\K\\d+ /etc/inventory_number.cmdline
register: result
# Since it is a reporting task
# which needs to deliver a result in any case
failed_when: result.rc != 0 and result.rc != 1
check_mode: false
changed_when: false
- name: Show result, if any
copy:
dest: /etc/inventory_number
content: |
{{ result.stdout_lines[0] }}
when: result.rc == 0
- name: Enable login screen after install
command: systemctl start systemd-logind.service
- name: Reboot
ansible.builtin.reboot:
reboot_timeout: 60