refactor(users): migrate system.user to system.users[] for multi-user support

This commit is contained in:
2026-02-12 22:52:15 +01:00
parent 66057bc9b2
commit 8f8ce341ae
14 changed files with 186 additions and 139 deletions

View File

@@ -4,9 +4,18 @@ ssh_pwauth: true
package_update: false
package_upgrade: false
users:
- name: "{{ system_cfg.user.name }}"
primary_group: "{{ system_cfg.user.name }}"
{% for user in system_cfg.users %}
- name: "{{ user.name }}"
primary_group: "{{ user.name }}"
groups: users
sudo: ALL=(ALL) NOPASSWD:ALL
passwd: "{{ system_cfg.user.password | password_hash('sha512') }}"
lock_passwd: False
sudo: "{{ user.sudo | default('ALL=(ALL) NOPASSWD:ALL') }}"
passwd: "{{ user.password | password_hash('sha512') }}"
lock_passwd: false
{% set ssh_keys = user.keys | default([]) %}
{% if ssh_keys | length > 0 %}
ssh_authorized_keys:
{% for key in ssh_keys %}
- "{{ key }}"
{% endfor %}
{% endif %}
{% endfor %}