fix(configuration): use chpasswd for root password and separate shell setting

This commit is contained in:
2026-02-20 22:27:17 +01:00
parent 42be0a5919
commit db2fab5e7d

View File

@@ -1,14 +1,17 @@
---
- name: Set root password
vars:
configuration_root_cmd: >-
{{ chroot_command }} /usr/sbin/usermod --password
'{{ system_cfg.root.password | password_hash('sha512') }}' root --shell {{ system_cfg.root.shell | default('/bin/bash') }}
ansible.builtin.command: "{{ configuration_root_cmd }}"
ansible.builtin.shell: >-
echo 'root:{{ system_cfg.root.password | password_hash("sha512") }}' | {{ chroot_command }} chpasswd -e
register: configuration_root_result
changed_when: configuration_root_result.rc == 0
no_log: true
- name: Set root shell
ansible.builtin.command: >-
{{ chroot_command }} /usr/sbin/usermod --shell {{ system_cfg.root.shell | default('/bin/bash') }} root
register: configuration_root_shell_result
changed_when: configuration_root_shell_result.rc == 0
- name: Create user accounts
vars:
configuration_user_group: >-