xoxys.users/tasks/users_univention.yml
Robert Kaussow e6a70d69c5
All checks were successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/docs Pipeline was successful
ci/woodpecker/push/notify Pipeline was successful
refctor: rework ci to ue ansible-lint and fix molecule
2024-08-19 16:06:19 +02:00

23 lines
864 B
YAML

---
# use system users and groups to prevent duplicate ids
# this is a workaround because udm_user not working
- name: Create groups
ansible.builtin.group:
name: "{{ item }}"
system: "yes"
state: present
loop: "{{ users_default_groups }}"
- name: Create users
ansible.builtin.user:
name: "{{ item.name }}"
groups: "{{ item.groups | default([]) | join(',') or omit }}"
append: "{{ True if (item.groups | default([]) | length > 0) else False }}"
password: "{{ item.password | password_hash('sha512', 65534 | random(seed=inventory_hostname) | string) if item.password is defined else '*' }}"
password_expire_min: "{{ item.password_expire_min | default(users_pass_min_day) }}"
shell: "{{ item.shell | default('/bin/bash') }}"
system: "yes"
loop: "{{ users_default_users }}"
loop_control:
label: "{{ item.name }}"