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

34 lines
953 B
YAML
Raw Normal View History

2022-10-10 03:36:22 +00:00
- name: Install packages
when: 'os_flavor == "freebsd"'
package:
name:
- zsh
2022-10-11 01:50:39 +00:00
- py39-jmespath # Needed on machine running ansible for json_query
2022-10-10 03:36:22 +00:00
state: present
- name: Install packages
when: 'os_flavor == "linux"'
package:
name:
- zsh
2022-10-11 01:50:39 +00:00
- python-jmespath # Needed on machine running ansible for json_query
2022-10-10 03:36:22 +00:00
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 }}"
2022-10-12 03:24:26 +00:00
- import_tasks: tasks/freebsd.yaml
when: 'os_flavor == "freebsd"'
2022-10-10 03:36:22 +00:00
2022-10-12 03:24:26 +00:00
- import_tasks: tasks/linux.yaml
when: 'os_flavor == "linux"'