fix(configuration): use chpasswd for root password and separate shell setting
This commit is contained in:
@@ -1,14 +1,17 @@
|
|||||||
---
|
---
|
||||||
- name: Set root password
|
- name: Set root password
|
||||||
vars:
|
ansible.builtin.shell: >-
|
||||||
configuration_root_cmd: >-
|
echo 'root:{{ system_cfg.root.password | password_hash("sha512") }}' | {{ chroot_command }} chpasswd -e
|
||||||
{{ 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 }}"
|
|
||||||
register: configuration_root_result
|
register: configuration_root_result
|
||||||
changed_when: configuration_root_result.rc == 0
|
changed_when: configuration_root_result.rc == 0
|
||||||
no_log: true
|
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
|
- name: Create user accounts
|
||||||
vars:
|
vars:
|
||||||
configuration_user_group: >-
|
configuration_user_group: >-
|
||||||
|
|||||||
Reference in New Issue
Block a user