machine_setup/ansible/roles/users/tasks/freebsd.yaml

19 lines
808 B
YAML
Raw Normal View History

2022-10-12 03:24:26 +00:00
- 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/local/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/local/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