fix(configuration): use chpasswd for root password and separate shell setting
This commit is contained in:
@@ -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: >-
|
||||
|
||||
Reference in New Issue
Block a user