add: support for multiple system accounts and package vars

This commit is contained in:
root 2025-07-01 17:30:15 +00:00
parent 4af2c65d8f
commit cef17b69f9
2 changed files with 53 additions and 2 deletions

46
roles/os_base/README.md Normal file
View File

@ -0,0 +1,46 @@
# OS Base
Example config:
```
system_accounts:
- name: sysmaint
state: 'present'
system: true
uid: 1000
groups:
- sudo
- wheel
comment: 'Jzn42.net maintenance user'
create_home: true
sshkey_state: 'present'
sshkeys:
- ssh-ed25519 AAA...
permissions: &maint_permissions
- sudo
- sudo_nopass
- libvirt
- name: jez·
state: 'present'
uid: 1001
groups:
- sudo
- wheel
comment: 'Jzn42 admin'
create_home: true
sshkey_state: 'present'
sshkeys:
- ssh-ed25519 AAA...
- ssh-ed25519 AAA...
permissions: *maint_permissions
system_packages:
- htop
- vim
- ncdu
- git
- iftop
- rsync
- bash
```

View File

@ -1,6 +1,11 @@
--- ---
system_accounts: []
system_packages: []
system_packages_norecommend: false system_packages_norecommend: false
system_packages_nosuggest: false system_packages_nosuggest: false
system_accounts__default: []
system_packages__default: []
system_accounts: "{{ vars | dict2items | selectattr('key', 'match', '^system_accounts__.*') | map(attribute='value') | list | flatten | unique }}"
system_packages: "{{ vars | dict2items | selectattr('key', 'match', '^system_packages__.*') | map(attribute='value') | list | flatten | unique }}"