machine_setup/ansible/roles/users/tasks/main.yaml
2024-06-02 12:09:45 -04:00

34 lines
954 B
YAML

- name: Install packages
when: 'os_flavor == "freebsd"'
package:
name:
- zsh
- py311-jmespath # Needed on machine running ansible for json_query
state: present
- name: Install packages
when: 'os_flavor == "linux"'
package:
name:
- zsh
- python-jmespath # Needed on machine running ansible for json_query
state: present
- name: Create group
group:
name: "{{ item.value.group | default(item.key) }}"
gid: "{{ item.value.gid | default(omit) }}"
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`]') }}"
- name: Create group
group:
name: "{{ item.name }}"
gid: "{{ item.gid | default(omit) }}"
loop: "{{ users | dict2items | community.general.json_query('[?value.initialize==`true`].value.groups') | flatten }}"
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'