diff --git a/roles/configuration/tasks/users.yml b/roles/configuration/tasks/users.yml index c86950a..d4c6817 100644 --- a/roles/configuration/tasks/users.yml +++ b/roles/configuration/tasks/users.yml @@ -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: >-