machine_setup/ansible/roles/users/tasks/linux.yaml
2022-10-11 23:24:26 -04:00

19 lines
796 B
YAML

- name: Create user
user:
name: "{{ item.key }}"
group: "{{ item.value.group | default(item.key) }}"
groups: "{{ item.value.groups | community.general.json_query('[*].name') }}"
shell: "{{ item.value.shell | default('/usr/bin/zsh') }}"
uid: "{{ item.value.uid | default(omit) }}"
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`]') }}"
when: item.value.groups is defined
- name: Create user
user:
name: "{{ item.key }}"
group: "{{ item.value.group | default(item.key) }}"
shell: "{{ item.value.shell | default('/usr/bin/zsh') }}"
uid: "{{ item.value.uid | default(omit) }}"
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`]') }}"
when: item.value.groups is not defined